Auto merge of #2446 - RalfJung:rustup, r=RalfJung
add test for dyn call issue Tests for https://github.com/rust-lang/miri/issues/2432
This commit is contained in:
commit
c0cbddc78a
@ -1 +1 @@
|
||||
2fdbf075cf502431ca9fee6616331b32e34f25de
|
||||
a86705942c4cfaaee60f2e7308ca2bca703a710f
|
||||
|
19
tests/fail/issue-miri-2432.rs
Normal file
19
tests/fail/issue-miri-2432.rs
Normal file
@ -0,0 +1,19 @@
|
||||
#![allow(where_clauses_object_safety)]
|
||||
|
||||
trait Trait {}
|
||||
|
||||
trait X {
|
||||
fn foo(&self)
|
||||
where
|
||||
Self: Trait;
|
||||
}
|
||||
|
||||
impl X for () {
|
||||
fn foo(&self) {}
|
||||
}
|
||||
|
||||
impl Trait for dyn X {}
|
||||
|
||||
pub fn main() {
|
||||
<dyn X as X>::foo(&()); //~ERROR: trying to call something that is not a method
|
||||
}
|
15
tests/fail/issue-miri-2432.stderr
Normal file
15
tests/fail/issue-miri-2432.stderr
Normal file
@ -0,0 +1,15 @@
|
||||
error: Undefined Behavior: `dyn` call trying to call something that is not a method
|
||||
--> $DIR/issue-miri-2432.rs:LL:CC
|
||||
|
|
||||
LL | <dyn X as X>::foo(&());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ `dyn` call trying to call something that is not a method
|
||||
|
|
||||
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
|
||||
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
|
||||
= note: backtrace:
|
||||
= note: inside `main` at $DIR/issue-miri-2432.rs:LL:CC
|
||||
|
||||
note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace
|
||||
|
||||
error: aborting due to previous error
|
||||
|
Loading…
x
Reference in New Issue
Block a user