diff --git a/rust-version b/rust-version index c8fd55f4c3b..198b3970e0d 100644 --- a/rust-version +++ b/rust-version @@ -1 +1 @@ -c94ed5ca91f1363b66970ce2cbd6e2773e3cb1d3 +814bc4fe9364865bfaa94d7825b8eabc11245c7c diff --git a/src/diagnostics.rs b/src/diagnostics.rs index ca3dd4dd66f..eed60c2696e 100644 --- a/src/diagnostics.rs +++ b/src/diagnostics.rs @@ -227,7 +227,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx TopFrameInfo { stack_size: this.active_thread_stack().len(), instance: Some(frame.instance), - span: frame.current_source_info().map_or(DUMMY_SP, |si| si.span), + span: frame.current_span(), } } diff --git a/tests/compile-fail/erroneous_const.rs b/tests/compile-fail/erroneous_const.rs new file mode 100644 index 00000000000..287e0735814 --- /dev/null +++ b/tests/compile-fail/erroneous_const.rs @@ -0,0 +1,19 @@ +//! Make sure we detect erroneous constants post-monomorphization even when they are unused. +//! (https://github.com/rust-lang/miri/issues/1382) +#![feature(const_panic)] +#![feature(never_type)] +#![warn(warnings, const_err)] + +struct PrintName(T); +impl PrintName { + const VOID: ! = panic!(); //~WARN any use of this value will cause an error +} + +fn no_codegen() { + if false { + let _ = PrintName::::VOID; //~ERROR referenced constant has errors + } +} +fn main() { + no_codegen::(); +}