-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Normalize field types before checking validity
- Loading branch information
1 parent
e7bbe8c
commit 866364c
Showing
2 changed files
with
45 additions
and
9 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
31 changes: 31 additions & 0 deletions
31
tests/ui/type-alias-impl-trait/struct-assignment-validity.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,31 @@ | ||
// compile-flags: -Zvalidate-mir | ||
// check-pass | ||
|
||
// Check that we don't cause cycle errors when validating pre-`Reveal::All` MIR | ||
// that assigns opaques through normalized projections. | ||
|
||
#![feature(impl_trait_in_assoc_type)] | ||
|
||
struct Bar; | ||
|
||
trait Trait { | ||
type Assoc; | ||
fn foo() -> Foo; | ||
} | ||
|
||
impl Trait for Bar { | ||
type Assoc = impl std::fmt::Debug; | ||
fn foo() -> Foo | ||
where | ||
Self::Assoc:, | ||
{ | ||
let x: <Bar as Trait>::Assoc = (); | ||
Foo { field: () } | ||
} | ||
} | ||
|
||
struct Foo { | ||
field: <Bar as Trait>::Assoc, | ||
} | ||
|
||
fn main() {} |