diff --git a/rust-version b/rust-version index 2c5cd796af..75124dc8ff 100644 --- a/rust-version +++ b/rust-version @@ -1 +1 @@ -d3d145ea1cae47ad392173f890577788117da3d9 +1a1876c9790f168fb51afa335a7ba3e6fc267d75 diff --git a/src/bin/miri.rs b/src/bin/miri.rs index 8a7133fea4..281a32b77c 100644 --- a/src/bin/miri.rs +++ b/src/bin/miri.rs @@ -68,7 +68,7 @@ impl rustc_driver::Callbacks for MiriCompilerCalls { queries: &'tcx rustc_interface::Queries<'tcx>, ) -> Compilation { queries.global_ctxt().unwrap().enter(|tcx| { - if tcx.sess.dcx().has_errors().is_some() { + if tcx.sess.dcx().has_errors_or_delayed_bugs().is_some() { tcx.dcx().fatal("miri cannot be run on programs that fail compilation"); } diff --git a/tests/fail/rustc-error2.rs b/tests/fail/rustc-error2.rs new file mode 100644 index 0000000000..fd2c539338 --- /dev/null +++ b/tests/fail/rustc-error2.rs @@ -0,0 +1,16 @@ +// Regression test for /~https://github.com/rust-lang/rust/issues/121508. +struct Struct(T); + +impl std::ops::Deref for Struct { + type Target = dyn Fn(T); + fn deref(&self) -> &assert_mem_uninitialized_valid::Target { + //~^ERROR: undeclared crate or module + unimplemented!() + } +} + +fn main() { + let f = Struct(Default::default()); + f(0); + f(0); +} diff --git a/tests/fail/rustc-error2.stderr b/tests/fail/rustc-error2.stderr new file mode 100644 index 0000000000..de2861a019 --- /dev/null +++ b/tests/fail/rustc-error2.stderr @@ -0,0 +1,9 @@ +error[E0433]: failed to resolve: use of undeclared crate or module `assert_mem_uninitialized_valid` + --> $DIR/rustc-error2.rs:LL:CC + | +LL | fn deref(&self) -> &assert_mem_uninitialized_valid::Target { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ use of undeclared crate or module `assert_mem_uninitialized_valid` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0433`.