File tree Expand file tree Collapse file tree 2 files changed +52
-0
lines changed
tests/ui/traits/next-solver/assembly Expand file tree Collapse file tree 2 files changed +52
-0
lines changed Original file line number Diff line number Diff line change 1+ //@ compile-flags: -Znext-solver
2+ //@ check-pass
3+
4+ // Regression test for trait-system-refactor-initiative#84.
5+ //
6+ // We try to infer `T::Rigid: Into<?0>` and have 2 candidates from where-clauses:
7+ //
8+ // - `Into<String>`
9+ // - `Into<<T::Rigid as Elaborate>::Assoc>`
10+ //
11+ // This causes ambiguity unless we normalize the alias in the second candidate
12+ // to detect that they actually result in the same constraints.
13+ trait Trait {
14+ type Rigid : Elaborate < Assoc = String > + Into < String > + Default ;
15+ }
16+
17+ trait Elaborate : Into < Self :: Assoc > {
18+ type Assoc ;
19+ }
20+
21+ fn test < T : Trait > ( ) {
22+ let rigid: T :: Rigid = Default :: default ( ) ;
23+ drop ( rigid. into ( ) ) ;
24+ }
25+
26+ fn main ( ) { }
Original file line number Diff line number Diff line change 1+ //@ compile-flags: -Znext-solver
2+ //@ check-pass
3+
4+ // Regression test for trait-system-refactor-initiative#86. This previously
5+ // failed with ambiguity due to multiple candidates with different
6+ // normalization.
7+
8+ trait Bar {
9+ type Item ;
10+ type Assoc : AsRef < [ Self :: Item ] > ;
11+ }
12+
13+ struct Foo < T : Bar > {
14+ t : <T as Bar >:: Assoc ,
15+ }
16+
17+ impl < T : Bar < Item = u32 > > Foo < T >
18+ where
19+ <T as Bar >:: Assoc : AsRef < [ u32 ] > ,
20+ {
21+ fn hello ( & self ) {
22+ println ! ( "{}" , self . t. as_ref( ) . len( ) ) ;
23+ }
24+ }
25+
26+ fn main ( ) { }
You can’t perform that action at this time.
0 commit comments