Use a dedicated type instead of a reference for the diagnostic context
This paves the way for tracking more state (e.g. error tainting) in the diagnostic context handle
This commit is contained in:
@@ -3,7 +3,7 @@ use rustc_ast::CRATE_NODE_ID;
|
||||
use rustc_data_structures::fx::{FxIndexMap, FxIndexSet};
|
||||
use rustc_data_structures::memmap::Mmap;
|
||||
use rustc_data_structures::temp_dir::MaybeTempDir;
|
||||
use rustc_errors::{DiagCtxt, ErrorGuaranteed, FatalError};
|
||||
use rustc_errors::{DiagCtxtHandle, ErrorGuaranteed, FatalError};
|
||||
use rustc_fs_util::{fix_windows_verbatim_for_gcc, try_canonicalize};
|
||||
use rustc_hir::def_id::{CrateNum, LOCAL_CRATE};
|
||||
use rustc_metadata::find_native_static_library;
|
||||
@@ -54,7 +54,7 @@ use std::process::{ExitStatus, Output, Stdio};
|
||||
use std::{env, fmt, fs, io, mem, str};
|
||||
use tracing::{debug, info, warn};
|
||||
|
||||
pub fn ensure_removed(dcx: &DiagCtxt, path: &Path) {
|
||||
pub fn ensure_removed(dcx: DiagCtxtHandle<'_>, path: &Path) {
|
||||
if let Err(e) = fs::remove_file(path) {
|
||||
if e.kind() != io::ErrorKind::NotFound {
|
||||
dcx.err(format!("failed to remove {}: {}", path.display(), e));
|
||||
|
||||
Reference in New Issue
Block a user