diff --git a/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp index f891ef556db4c..e6cb3c991e491 100644 --- a/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp +++ b/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp @@ -506,6 +506,8 @@ LLVMRustWriteOutputFile(LLVMTargetMachineRef Target, LLVMModuleRef M, Error CodeGenError = runCodeGenPipeline(*unwrap(Target), *unwrap(M), BOS, BDwoOS.get(), FileType, !VerifyIR, DisableSimplifyLibCalls); + if (CodeGenError) + return LLVMRustResult::Failure; #else std::unique_ptr PM = std::make_unique();