File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1869,10 +1869,14 @@ fn resolve_type_param_assoc_type_shorthand(
18691869 . skip_binder ( ) ;
18701870 let args = EarlyBinder :: bind ( args) . instantiate ( interner, bounded_trait_ref. args ) ;
18711871 let current_result = StoredEarlyBinder :: bind ( ( assoc_type, args. store ( ) ) ) ;
1872- if let Some ( this_trait_resolution) = this_trait_resolution {
1873- return AssocTypeShorthandResolution :: Ambiguous {
1874- sub_trait_resolution : Some ( this_trait_resolution) ,
1875- } ;
1872+ if let Some ( this_trait_resolution) = & this_trait_resolution {
1873+ if * this_trait_resolution == current_result {
1874+ continue ;
1875+ } else {
1876+ return AssocTypeShorthandResolution :: Ambiguous {
1877+ sub_trait_resolution : Some ( this_trait_resolution. clone ( ) ) ,
1878+ } ;
1879+ }
18761880 } else if let Some ( prev_resolution) = & supertraits_resolution {
18771881 if let AssocTypeShorthandResolution :: Ambiguous {
18781882 sub_trait_resolution : Some ( prev_resolution) ,
Original file line number Diff line number Diff line change @@ -2856,3 +2856,31 @@ fn foo<T: B>(v: T::T) {}
28562856 "# ,
28572857 ) ;
28582858}
2859+
2860+ #[ test]
2861+ fn regression_ ( ) {
2862+ check_types (
2863+ r#"
2864+ //- minicore: fn
2865+ trait Super {
2866+ type Assoc;
2867+ fn foo(self) -> Self::Assoc
2868+ where
2869+ Self: Sub,
2870+ { loop {} }
2871+ }
2872+ trait Sub: Super {}
2873+
2874+ struct Struct;
2875+ impl Super for Struct {
2876+ type Assoc = u8;
2877+ }
2878+ impl Sub for Struct {}
2879+
2880+ fn foo() {
2881+ Struct.foo();
2882+ // ^^^^^^^^^^^^ u8
2883+ }
2884+ "# ,
2885+ ) ;
2886+ }
You can’t perform that action at this time.
0 commit comments