Skip to content

Commit c0cbddc

Browse files
committed
Auto merge of #2446 - RalfJung:rustup, r=RalfJung
add test for dyn call issue Tests for #2432
2 parents b938529 + 5875c0d commit c0cbddc

File tree

3 files changed

+35
-1
lines changed

3 files changed

+35
-1
lines changed

rust-version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2fdbf075cf502431ca9fee6616331b32e34f25de
1+
a86705942c4cfaaee60f2e7308ca2bca703a710f

tests/fail/issue-miri-2432.rs

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#![allow(where_clauses_object_safety)]
2+
3+
trait Trait {}
4+
5+
trait X {
6+
fn foo(&self)
7+
where
8+
Self: Trait;
9+
}
10+
11+
impl X for () {
12+
fn foo(&self) {}
13+
}
14+
15+
impl Trait for dyn X {}
16+
17+
pub fn main() {
18+
<dyn X as X>::foo(&()); //~ERROR: trying to call something that is not a method
19+
}

tests/fail/issue-miri-2432.stderr

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
error: Undefined Behavior: `dyn` call trying to call something that is not a method
2+
--> $DIR/issue-miri-2432.rs:LL:CC
3+
|
4+
LL | <dyn X as X>::foo(&());
5+
| ^^^^^^^^^^^^^^^^^^^^^^ `dyn` call trying to call something that is not a method
6+
|
7+
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
8+
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
9+
= note: backtrace:
10+
= note: inside `main` at $DIR/issue-miri-2432.rs:LL:CC
11+
12+
note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace
13+
14+
error: aborting due to previous error
15+

0 commit comments

Comments
 (0)