-
Notifications
You must be signed in to change notification settings - Fork 329
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #2446 - RalfJung:rustup, r=RalfJung
add test for dyn call issue Tests for #2432
- Loading branch information
Showing
3 changed files
with
35 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
2fdbf075cf502431ca9fee6616331b32e34f25de | ||
a86705942c4cfaaee60f2e7308ca2bca703a710f |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|