Skip to content

Automatic Rustup #3241

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Dec 26, 2023
2 changes: 1 addition & 1 deletion rust-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3166bbef9248fce2695899e21203f42a21046551
2271c26e4a8e062bb00d709d0ccb5846e0c341b9
12 changes: 6 additions & 6 deletions src/bin/miri.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand All @@ -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 \
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/borrow_tracker/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 =>
Expand Down
4 changes: 2 additions & 2 deletions src/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
);
}
Expand Down Expand Up @@ -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",
);
}
Expand Down
12 changes: 6 additions & 6 deletions src/eval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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."
);
Expand Down Expand Up @@ -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]`."
);
});
Expand Down Expand Up @@ -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.
Expand All @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion src/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(())
}
Expand Down