-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
More assertions, tests, and miri coverage
- Loading branch information
1 parent
76eb4f3
commit 1543bb4
Showing
5 changed files
with
131 additions
and
62 deletions.
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
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
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
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 |
---|---|---|
|
@@ -2,3 +2,5 @@ before | |
goodbye | ||
before | ||
goodbye | ||
Hello! | ||
Hello! |
30 changes: 30 additions & 0 deletions
30
tests/ui/traits/trait-upcasting/supertraits-modulo-inner-binder.rs
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,30 @@ | ||
//@ run-pass | ||
|
||
#![feature(trait_upcasting)] | ||
|
||
trait Super<U> { | ||
fn call(&self) | ||
where | ||
U: HigherRanked, | ||
{ | ||
} | ||
} | ||
|
||
impl<T> Super<T> for () {} | ||
|
||
trait HigherRanked {} | ||
impl HigherRanked for for<'a> fn(&'a ()) {} | ||
|
||
trait Unimplemented {} | ||
impl<T: Unimplemented> HigherRanked for T {} | ||
|
||
trait Sub: Super<fn(&'static ())> + Super<for<'a> fn(&'a ())> {} | ||
impl Sub for () {} | ||
|
||
fn main() { | ||
let a: &dyn Sub = &(); | ||
// `Super<fn(&'static ())>` and `Super<for<'a> fn(&'a ())>` have different | ||
// vtables and we need to upcast to the latter! | ||
let b: &dyn Super<for<'a> fn(&'a ())> = a; | ||
b.call(); | ||
} |