-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Instantiate binders in supertrait_vtable_slot
- Loading branch information
1 parent
c3ce4e6
commit af3f212
Showing
2 changed files
with
38 additions
and
17 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
15 changes: 8 additions & 7 deletions
15
tests/ui/traits/trait-upcasting/higher-ranked-upcasting-ok.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 |
---|---|---|
@@ -1,21 +1,22 @@ | ||
//@ revisions: current next | ||
//@ ignore-compare-mode-next-solver (explicit revisions) | ||
//@[next] compile-flags: -Znext-solver | ||
//@ check-pass | ||
//@ build-pass | ||
|
||
// We should be able to instantiate a binder during trait upcasting. | ||
// This test could be `check-pass`, but we should make sure that we | ||
// do so in both trait solvers. | ||
// Check that we are able to instantiate a binder during trait upcasting, | ||
// and that it doesn't cause any issues with codegen either. | ||
|
||
#![feature(trait_upcasting)] | ||
|
||
trait Supertrait<'a, 'b> {} | ||
trait Subtrait<'a, 'b>: Supertrait<'a, 'b> {} | ||
|
||
impl<'a> Supertrait<'a, 'a> for () {} | ||
impl<'a> Subtrait<'a, 'a> for () {} | ||
impl Supertrait<'_, '_> for () {} | ||
impl Subtrait<'_, '_> for () {} | ||
fn ok(x: &dyn for<'a, 'b> Subtrait<'a, 'b>) -> &dyn for<'a> Supertrait<'a, 'a> { | ||
x | ||
} | ||
|
||
fn main() {} | ||
fn main() { | ||
ok(&()); | ||
} |