diff --git a/rust-version b/rust-version index 6af1314799..5298ff36f2 100644 --- a/rust-version +++ b/rust-version @@ -1 +1 @@ -3166bbef9248fce2695899e21203f42a21046551 +2271c26e4a8e062bb00d709d0ccb5846e0c341b9 diff --git a/src/bin/miri.rs b/src/bin/miri.rs index f83847d13f..ad6a5a669f 100644 --- a/src/bin/miri.rs +++ b/src/bin/miri.rs @@ -66,19 +66,19 @@ impl rustc_driver::Callbacks for MiriCompilerCalls { ) -> Compilation { queries.global_ctxt().unwrap().enter(|tcx| { if tcx.sess.compile_status().is_err() { - tcx.sess.fatal("miri cannot be run on programs that fail compilation"); + tcx.dcx().fatal("miri cannot be run on programs that fail compilation"); } let early_dcx = EarlyDiagCtxt::new(tcx.sess.opts.error_format); init_late_loggers(&early_dcx, tcx); if !tcx.crate_types().contains(&CrateType::Executable) { - tcx.sess.fatal("miri only makes sense on bin crates"); + tcx.dcx().fatal("miri only makes sense on bin crates"); } let (entry_def_id, entry_type) = if let Some(entry_def) = tcx.entry_fn(()) { entry_def } else { - tcx.sess.fatal("miri can only run programs that have a main function"); + tcx.dcx().fatal("miri can only run programs that have a main function"); }; let mut config = self.miri_config.clone(); @@ -91,13 +91,13 @@ impl rustc_driver::Callbacks for MiriCompilerCalls { } if tcx.sess.opts.optimize != OptLevel::No { - tcx.sess.warn("Miri does not support optimizations. If you have enabled optimizations \ + tcx.dcx().warn("Miri does not support optimizations. If you have enabled optimizations \ by selecting a Cargo profile (such as --release) which changes other profile settings \ such as whether debug assertions and overflow checks are enabled, those settings are \ still applied."); } if tcx.sess.mir_opt_level() > 0 { - tcx.sess.warn("You have explicitly enabled MIR optimizations, overriding Miri's default \ + tcx.dcx().warn("You have explicitly enabled MIR optimizations, overriding Miri's default \ which is to completely disable them. Any optimizations may hide UB that Miri would \ otherwise detect, and it is not necessarily possible to predict what kind of UB will \ be missed. If you are enabling optimizations to make Miri run faster, we advise using \ @@ -110,7 +110,7 @@ impl rustc_driver::Callbacks for MiriCompilerCalls { i32::try_from(return_code).expect("Return value was too large!"), ); } - tcx.sess.abort_if_errors(); + tcx.dcx().abort_if_errors(); }); Compilation::Stop diff --git a/src/borrow_tracker/mod.rs b/src/borrow_tracker/mod.rs index a6961208ff..74ff6ed4e0 100644 --- a/src/borrow_tracker/mod.rs +++ b/src/borrow_tracker/mod.rs @@ -343,7 +343,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> { let method = this.machine.borrow_tracker.as_ref().unwrap().borrow().borrow_tracker_method; match method { BorrowTrackerMethod::StackedBorrows => { - this.tcx.tcx.sess.warn("Stacked Borrows does not support named pointers; `miri_pointer_name` is a no-op"); + this.tcx.tcx.dcx().warn("Stacked Borrows does not support named pointers; `miri_pointer_name` is a no-op"); Ok(()) } BorrowTrackerMethod::TreeBorrows => diff --git a/src/diagnostics.rs b/src/diagnostics.rs index 4c284ff81e..4375fa67b8 100644 --- a/src/diagnostics.rs +++ b/src/diagnostics.rs @@ -384,7 +384,7 @@ pub fn report_error<'tcx, 'mir>( // Include a note like `std` does when we omit frames from a backtrace if was_pruned { - ecx.tcx.sess.dcx().note( + ecx.tcx.dcx().note( "some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace", ); } @@ -431,7 +431,7 @@ pub fn report_leaks<'mir, 'tcx>( ); } if any_pruned { - ecx.tcx.sess.dcx().note( + ecx.tcx.dcx().note( "some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace", ); } diff --git a/src/eval.rs b/src/eval.rs index 6013c0bd34..6095b8842e 100644 --- a/src/eval.rs +++ b/src/eval.rs @@ -278,7 +278,7 @@ pub fn create_ecx<'mir, 'tcx: 'mir>( // Make sure we have MIR. We check MIR for some stable monomorphic function in libcore. let sentinel = ecx.try_resolve_path(&["core", "ascii", "escape_default"], Namespace::ValueNS); if !matches!(sentinel, Some(s) if tcx.is_mir_available(s.def.def_id())) { - tcx.sess.fatal( + tcx.dcx().fatal( "the current sysroot was built without `-Zalways-encode-mir`, or libcore seems missing. \ Use `cargo miri setup` to prepare a sysroot that is suitable for Miri." ); @@ -363,7 +363,7 @@ pub fn create_ecx<'mir, 'tcx: 'mir>( match entry_type { EntryFnType::Main { .. } => { let start_id = tcx.lang_items().start_fn().unwrap_or_else(|| { - tcx.sess.fatal( + tcx.dcx().fatal( "could not find start function. Make sure the entry point is marked with `#[start]`." ); }); @@ -462,8 +462,8 @@ pub fn eval_entry<'tcx>( if leak_check && !ignore_leaks { // Check for thread leaks. if !ecx.have_all_terminated() { - tcx.sess.err("the main thread terminated without waiting for all remaining threads"); - tcx.sess.note("pass `-Zmiri-ignore-leaks` to disable this check"); + tcx.dcx().err("the main thread terminated without waiting for all remaining threads"); + tcx.dcx().note("pass `-Zmiri-ignore-leaks` to disable this check"); return None; } // Check for memory leaks. @@ -474,10 +474,10 @@ pub fn eval_entry<'tcx>( let leak_message = "the evaluated program leaked memory, pass `-Zmiri-ignore-leaks` to disable this check"; if ecx.machine.collect_leak_backtraces { // If we are collecting leak backtraces, each leak is a distinct error diagnostic. - tcx.sess.note(leak_message); + tcx.dcx().note(leak_message); } else { // If we do not have backtraces, we just report an error without any span. - tcx.sess.err(leak_message); + tcx.dcx().err(leak_message); }; // Ignore the provided return code - let the reported error // determine the return code. diff --git a/src/helpers.rs b/src/helpers.rs index 57dc3b4734..d2fd51b099 100644 --- a/src/helpers.rs +++ b/src/helpers.rs @@ -539,7 +539,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> { RejectOpWith::Abort => isolation_abort_error(op_name), RejectOpWith::WarningWithoutBacktrace => { this.tcx - .sess + .dcx() .warn(format!("{op_name} was made to return an error due to isolation")); Ok(()) }