Skip to content

Commit

Permalink
add regression test
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed Feb 29, 2024
1 parent 70758a7 commit 2a376ce
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/tools/miri/tests/fail/rustc-error2.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Regression test for https://github.com/rust-lang/rust/issues/121508.
struct Struct<T>(T);

impl<T> std::ops::Deref for Struct<T> {
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);
}
9 changes: 9 additions & 0 deletions src/tools/miri/tests/fail/rustc-error2.stderr
Original file line number Diff line number Diff line change
@@ -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`.

0 comments on commit 2a376ce

Please sign in to comment.