Skip to content

Commit 11908a0

Browse files
committed
Auto merge of #3241 - rust-lang:rustup-2023-12-26, r=RalfJung
Automatic Rustup
2 parents 750d82d + 2167282 commit 11908a0

File tree

6 files changed

+17
-17
lines changed

6 files changed

+17
-17
lines changed

rust-version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3166bbef9248fce2695899e21203f42a21046551
1+
2271c26e4a8e062bb00d709d0ccb5846e0c341b9

src/bin/miri.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -66,19 +66,19 @@ impl rustc_driver::Callbacks for MiriCompilerCalls {
6666
) -> Compilation {
6767
queries.global_ctxt().unwrap().enter(|tcx| {
6868
if tcx.sess.compile_status().is_err() {
69-
tcx.sess.fatal("miri cannot be run on programs that fail compilation");
69+
tcx.dcx().fatal("miri cannot be run on programs that fail compilation");
7070
}
7171

7272
let early_dcx = EarlyDiagCtxt::new(tcx.sess.opts.error_format);
7373
init_late_loggers(&early_dcx, tcx);
7474
if !tcx.crate_types().contains(&CrateType::Executable) {
75-
tcx.sess.fatal("miri only makes sense on bin crates");
75+
tcx.dcx().fatal("miri only makes sense on bin crates");
7676
}
7777

7878
let (entry_def_id, entry_type) = if let Some(entry_def) = tcx.entry_fn(()) {
7979
entry_def
8080
} else {
81-
tcx.sess.fatal("miri can only run programs that have a main function");
81+
tcx.dcx().fatal("miri can only run programs that have a main function");
8282
};
8383
let mut config = self.miri_config.clone();
8484

@@ -91,13 +91,13 @@ impl rustc_driver::Callbacks for MiriCompilerCalls {
9191
}
9292

9393
if tcx.sess.opts.optimize != OptLevel::No {
94-
tcx.sess.warn("Miri does not support optimizations. If you have enabled optimizations \
94+
tcx.dcx().warn("Miri does not support optimizations. If you have enabled optimizations \
9595
by selecting a Cargo profile (such as --release) which changes other profile settings \
9696
such as whether debug assertions and overflow checks are enabled, those settings are \
9797
still applied.");
9898
}
9999
if tcx.sess.mir_opt_level() > 0 {
100-
tcx.sess.warn("You have explicitly enabled MIR optimizations, overriding Miri's default \
100+
tcx.dcx().warn("You have explicitly enabled MIR optimizations, overriding Miri's default \
101101
which is to completely disable them. Any optimizations may hide UB that Miri would \
102102
otherwise detect, and it is not necessarily possible to predict what kind of UB will \
103103
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 {
110110
i32::try_from(return_code).expect("Return value was too large!"),
111111
);
112112
}
113-
tcx.sess.abort_if_errors();
113+
tcx.dcx().abort_if_errors();
114114
});
115115

116116
Compilation::Stop

src/borrow_tracker/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
343343
let method = this.machine.borrow_tracker.as_ref().unwrap().borrow().borrow_tracker_method;
344344
match method {
345345
BorrowTrackerMethod::StackedBorrows => {
346-
this.tcx.tcx.sess.warn("Stacked Borrows does not support named pointers; `miri_pointer_name` is a no-op");
346+
this.tcx.tcx.dcx().warn("Stacked Borrows does not support named pointers; `miri_pointer_name` is a no-op");
347347
Ok(())
348348
}
349349
BorrowTrackerMethod::TreeBorrows =>

src/diagnostics.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ pub fn report_error<'tcx, 'mir>(
384384

385385
// Include a note like `std` does when we omit frames from a backtrace
386386
if was_pruned {
387-
ecx.tcx.sess.dcx().note(
387+
ecx.tcx.dcx().note(
388388
"some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace",
389389
);
390390
}
@@ -431,7 +431,7 @@ pub fn report_leaks<'mir, 'tcx>(
431431
);
432432
}
433433
if any_pruned {
434-
ecx.tcx.sess.dcx().note(
434+
ecx.tcx.dcx().note(
435435
"some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace",
436436
);
437437
}

src/eval.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ pub fn create_ecx<'mir, 'tcx: 'mir>(
278278
// Make sure we have MIR. We check MIR for some stable monomorphic function in libcore.
279279
let sentinel = ecx.try_resolve_path(&["core", "ascii", "escape_default"], Namespace::ValueNS);
280280
if !matches!(sentinel, Some(s) if tcx.is_mir_available(s.def.def_id())) {
281-
tcx.sess.fatal(
281+
tcx.dcx().fatal(
282282
"the current sysroot was built without `-Zalways-encode-mir`, or libcore seems missing. \
283283
Use `cargo miri setup` to prepare a sysroot that is suitable for Miri."
284284
);
@@ -363,7 +363,7 @@ pub fn create_ecx<'mir, 'tcx: 'mir>(
363363
match entry_type {
364364
EntryFnType::Main { .. } => {
365365
let start_id = tcx.lang_items().start_fn().unwrap_or_else(|| {
366-
tcx.sess.fatal(
366+
tcx.dcx().fatal(
367367
"could not find start function. Make sure the entry point is marked with `#[start]`."
368368
);
369369
});
@@ -462,8 +462,8 @@ pub fn eval_entry<'tcx>(
462462
if leak_check && !ignore_leaks {
463463
// Check for thread leaks.
464464
if !ecx.have_all_terminated() {
465-
tcx.sess.err("the main thread terminated without waiting for all remaining threads");
466-
tcx.sess.note("pass `-Zmiri-ignore-leaks` to disable this check");
465+
tcx.dcx().err("the main thread terminated without waiting for all remaining threads");
466+
tcx.dcx().note("pass `-Zmiri-ignore-leaks` to disable this check");
467467
return None;
468468
}
469469
// Check for memory leaks.
@@ -474,10 +474,10 @@ pub fn eval_entry<'tcx>(
474474
let leak_message = "the evaluated program leaked memory, pass `-Zmiri-ignore-leaks` to disable this check";
475475
if ecx.machine.collect_leak_backtraces {
476476
// If we are collecting leak backtraces, each leak is a distinct error diagnostic.
477-
tcx.sess.note(leak_message);
477+
tcx.dcx().note(leak_message);
478478
} else {
479479
// If we do not have backtraces, we just report an error without any span.
480-
tcx.sess.err(leak_message);
480+
tcx.dcx().err(leak_message);
481481
};
482482
// Ignore the provided return code - let the reported error
483483
// determine the return code.

src/helpers.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
539539
RejectOpWith::Abort => isolation_abort_error(op_name),
540540
RejectOpWith::WarningWithoutBacktrace => {
541541
this.tcx
542-
.sess
542+
.dcx()
543543
.warn(format!("{op_name} was made to return an error due to isolation"));
544544
Ok(())
545545
}

0 commit comments

Comments
 (0)