Skip to content

Commit

Permalink
Auto merge of #2446 - RalfJung:rustup, r=RalfJung
Browse files Browse the repository at this point in the history
add test for dyn call issue

Tests for #2432
  • Loading branch information
bors committed Jul 26, 2022
2 parents b938529 + 5875c0d commit c0cbddc
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 1 deletion.
2 changes: 1 addition & 1 deletion rust-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2fdbf075cf502431ca9fee6616331b32e34f25de
a86705942c4cfaaee60f2e7308ca2bca703a710f
19 changes: 19 additions & 0 deletions tests/fail/issue-miri-2432.rs
Original file line number Diff line number Diff line change
@@ -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 changes: 15 additions & 0 deletions tests/fail/issue-miri-2432.stderr
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit c0cbddc

Please sign in to comment.