about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src/back/write.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2021-02-17 19:39:58 +0000
committerbors <bors@rust-lang.org>2021-02-17 19:39:58 +0000
commit152f6609246558be5e2582e67376194815e6ba0d (patch)
tree2ff1f32fc6c1440a034dc09c11ca80613489e1e9 /compiler/rustc_codegen_llvm/src/back/write.rs
parent5ef21063f0c0fd5b973bfa8cb88c0b70982da977 (diff)
parent03477e9a26fb1d600e21dc33116063f71ba295ef (diff)
downloadrust-152f6609246558be5e2582e67376194815e6ba0d.tar.gz
rust-152f6609246558be5e2582e67376194815e6ba0d.zip
Auto merge of #82235 - GuillaumeGomez:rollup-oflxc08, r=GuillaumeGomez
Rollup of 11 pull requests

Successful merges:

 - #79981 (Add 'consider using' message to overflowing_literals)
 - #82094 (To digit simplification)
 - #82105 (Don't fail to remove files if they are missing)
 - #82136 (Fix ICE: Use delay_span_bug for mismatched subst/hir arg)
 - #82169 (Document that `assert!` format arguments are evaluated lazily)
 - #82174 (Replace File::create and write_all with fs::write)
 - #82196 (Add caveat to Path::display() about lossiness)
 - #82198 (Use internal iteration in Iterator::is_sorted_by)
 - #82204 (Update books)
 - #82207 (rustdoc: treat edition 2021 as unstable)
 - #82231 (Add long explanation for E0543)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/back/write.rs')
-rw-r--r--compiler/rustc_codegen_llvm/src/back/write.rs5
1 files changed, 2 insertions, 3 deletions
diff --git a/compiler/rustc_codegen_llvm/src/back/write.rs b/compiler/rustc_codegen_llvm/src/back/write.rs
index 8b737c9a2e5..5f8a11ab94e 100644
--- a/compiler/rustc_codegen_llvm/src/back/write.rs
+++ b/compiler/rustc_codegen_llvm/src/back/write.rs
@@ -11,6 +11,7 @@ use crate::llvm_util;
 use crate::type_::Type;
 use crate::LlvmCodegenBackend;
 use crate::ModuleLlvm;
+use rustc_codegen_ssa::back::link::ensure_removed;
 use rustc_codegen_ssa::back::write::{
     BitcodeSection, CodegenContext, EmitObj, ModuleConfig, TargetMachineFactoryConfig,
     TargetMachineFactoryFn,
@@ -879,9 +880,7 @@ pub(crate) unsafe fn codegen(
 
                 if !config.emit_bc {
                     debug!("removing_bitcode {:?}", bc_out);
-                    if let Err(e) = fs::remove_file(&bc_out) {
-                        diag_handler.err(&format!("failed to remove bitcode: {}", e));
-                    }
+                    ensure_removed(diag_handler, &bc_out);
                 }
             }