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:
bors 2022-07-26 02:41:55 +00:00
commit c0cbddc78a
3 changed files with 35 additions and 1 deletions

View File

@ -1 +1 @@
2fdbf075cf502431ca9fee6616331b32e34f25de
a86705942c4cfaaee60f2e7308ca2bca703a710f

View 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
}

View 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