forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#131042 - compiler-errors:supertrait-vtable, r=lcnr Instantiate binders in `supertrait_vtable_slot` `supertrait_vtable_slot` was previously using structural equality when probing for the vtable slot, which led to an ICE since we need a *subtype* match, not an exact match. Fixes rust-lang#131027 r? lcnr
- Loading branch information
Showing
3 changed files
with
89 additions
and
33 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
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(&()); | ||
} |