use rustc_data_structures::fx::FxHashSet;
use rustc_data_structures::temp_dir::MaybeTempDir;
+use rustc_errors::Handler;
use rustc_fs_util::fix_windows_verbatim_for_gcc;
use rustc_hir::def_id::CrateNum;
use rustc_middle::middle::cstore::{EncodedMetadata, LibSource};
use std::process::{ExitStatus, Output, Stdio};
use std::{ascii, char, env, fmt, fs, io, mem, str};
-pub fn remove(sess: &Session, path: &Path) {
+pub fn ensure_removed(diag_handler: &Handler, path: &Path) {
if let Err(e) = fs::remove_file(path) {
- sess.err(&format!("failed to remove {}: {}", path.display(), e));
+ if e.kind() != io::ErrorKind::NotFound {
+ diag_handler.err(&format!("failed to remove {}: {}", path.display(), e));
+ }
}
}
if !sess.opts.cg.save_temps {
let remove_temps_from_module = |module: &CompiledModule| {
if let Some(ref obj) = module.object {
- remove(sess, obj);
+ ensure_removed(sess.diagnostic(), obj);
}
if let Some(ref obj) = module.dwarf_object {
- remove(sess, obj);
+ ensure_removed(sess.diagnostic(), obj);
}
};
("x86_64", "tvos") => "appletvsimulator",
("arm", "ios") => "iphoneos",
("aarch64", "ios") if llvm_target.contains("macabi") => "macosx",
+ ("aarch64", "ios") if llvm_target.contains("sim") => "iphonesimulator",
("aarch64", "ios") => "iphoneos",
("x86", "ios") => "iphonesimulator",
("x86_64", "ios") if llvm_target.contains("macabi") => "macosx",