Change:
Started occurring after merged To exemplify: environment variable to path Another example of a module pass exemplifying a crash: This is preventing from upgrading compatibility with any Rust version 1.2:
Opened a PR that fixes this

Discussion:
K_COFF, } <ins> /// Represents the different LLVM passes Rust supports #[derive(Copy, Clone, PartialEq, Debug)] #[repr(C)] pub enum SupportedPassKind { Function, Module, Unsupported, } </ins> // Opaque pointer types #[allow(missing_copy_implementations)] pub enum Module_opaque {}

pub fn LLVMIsAAllocaInst(value_ref: ValueRef) -> ValueRef; pub fn LLVMIsAConstantInt(value_ref: ValueRef) -> ValueRef; <del> pub fn LLVMRustAddPass(PM: PassManagerRef, Pass: *const c_char) -> bool; </del> <ins> pub fn LLVMRustPassKind(Pass: PassRef) -> SupportedPassKind; pub fn LLVMRustFindAndCreatePass(Pass: *const c_char) -> PassRef; pub fn LLVMRustAddPass(PM: PassManagerRef, Pass: PassRef); </ins> pub fn LLVMRustCreateTargetMachine(Triple: *const c_char, CPU: *const c_char, Features: *const c_char,

unsafe { let pm = llvm::LLVMCreatePassManager(); llvm::LLVMRustAddAnalysisPasses(tm, pm, llmod); <del> llvm::LLVMRustAddPass(pm, "verify0".as_ptr() as *const _); </del> <ins> let pass = llvm::LLVMRustFindAndCreatePass("verify0".as_ptr() as *const _); assert!(!pass.is_null()); llvm::LLVMRustAddPass(pm, pass); </ins> with_llvm_pmb(llmod, config, &mut |b| { llvm::LLVMPassManagerBuilderPopulateLTOPassManager(b, pm,

/* RunInliner = */ True); }); <del> llvm::LLVMRustAddPass(pm, "verify0".as_ptr() as *const _); </del> <ins> let pass = llvm::LLVMRustFindAndCreatePass("verify0".as_ptr() as *const _); assert!(!pass.is_null()); llvm::LLVMRustAddPass(pm, pass); </ins> time(sess.time_passes(), "LTO passes", || llvm::LLVMRunPassManager(pm, llmod));

// If we're verifying or linting, add them to the function pass // manager. <del> let addpass = |pass: &str| { let pass = CString::new(pass).unwrap(); llvm::LLVMRustAddPass(fpm, pass.as_ptr()) </del> <ins> let addpass = |pass_name: &str| { let pass_name = CString::new(pass_name).unwrap(); let pass = llvm::LLVMRustFindAndCreatePass(pass_name.as_ptr()); if pass.is_null() { return false; } let pass_manager = match llvm::LLVMRustPassKind(pass) { llvm::SupportedPassKind::Function => fpm, llvm::SupportedPassKind::Module => mpm, llvm::SupportedPassKind::Unsupported => { cgcx.handler.err("Encountered LLVM pass kind we can't handle"); return true }, }; llvm::LLVMRustAddPass(pass_manager, pass); true </ins> }; if !config.no_verify { assert!(addpass("verify")); }

initializeTarget(Registry); } <del> extern "C" bool LLVMRustAddPass(LLVMPassManagerRef PM, const char *PassName) { PassManagerBase *pm = unwrap(PM); </del> <ins> enum class SupportedPassKind { Function, Module, Unsupported }; extern "C" Pass* LLVMRustFindAndCreatePass(const char *PassName) { </ins> StringRef SR(PassName); PassRegistry *PR = PassRegistry::getPassRegistry(); const PassInfo *PI = PR->getPassInfo(SR); if (PI) { <del> pm->add(PI->createPass()); return true; </del> <ins> return PI->createPass(); </ins> } <del> return false; </del> <ins> return NULL; } extern "C" SupportedPassKind LLVMRustPassKind(Pass *pass) { assert(pass); PassKind passKind = pass->getPassKind(); if (passKind == PT_Module) { return SupportedPassKind::Module; } else if (passKind == PT_Function) { return SupportedPassKind::Function; } else { return SupportedPassKind::Unsupported; } } extern "C" void LLVMRustAddPass(LLVMPassManagerRef PM, Pass *pass) { assert(pass); PassManagerBase *pm = unwrap(PM); pm->add(pass); </ins> } extern "C" LLVMTargetMachineRef