@@ -1805,22 +1805,27 @@ fn resolve_type_param_assoc_type_shorthand(
18051805 }
18061806 AssocTypeShorthandResolution :: Cycle => return AssocTypeShorthandResolution :: Cycle ,
18071807 } ;
1808+ let ( assoc_type, args) = assoc_type_and_args
1809+ . get_with ( |( assoc_type, args) | ( * assoc_type, args. as_ref ( ) ) )
1810+ . skip_binder ( ) ;
1811+ let args = EarlyBinder :: bind ( args) . instantiate ( interner, bounded_trait_ref. args ) ;
1812+ let current_result = StoredEarlyBinder :: bind ( ( assoc_type, args. store ( ) ) ) ;
18081813 if let Some ( this_trait_resolution) = this_trait_resolution {
18091814 return AssocTypeShorthandResolution :: Ambiguous {
18101815 sub_trait_resolution : Some ( this_trait_resolution) ,
18111816 } ;
18121817 } else if let Some ( prev_resolution) = & supertraits_resolution {
1813- if prev_resolution == lookup_on_bounded_trait {
1814- return AssocTypeShorthandResolution :: Ambiguous { sub_trait_resolution : None } ;
1815- } else {
1818+ if let AssocTypeShorthandResolution :: Ambiguous {
1819+ sub_trait_resolution : Some ( prev_resolution) ,
1820+ }
1821+ | AssocTypeShorthandResolution :: Resolved ( prev_resolution) = prev_resolution
1822+ && * prev_resolution == current_result
1823+ {
18161824 continue ;
1825+ } else {
1826+ return AssocTypeShorthandResolution :: Ambiguous { sub_trait_resolution : None } ;
18171827 }
18181828 } else {
1819- let ( assoc_type, args) = assoc_type_and_args
1820- . get_with ( |( assoc_type, args) | ( * assoc_type, args. as_ref ( ) ) )
1821- . skip_binder ( ) ;
1822- let args = EarlyBinder :: bind ( args) . instantiate ( interner, bounded_trait_ref. args ) ;
1823- let current_result = StoredEarlyBinder :: bind ( ( assoc_type, args. store ( ) ) ) ;
18241829 supertraits_resolution = Some ( match lookup_on_bounded_trait {
18251830 AssocTypeShorthandResolution :: Resolved ( _) => {
18261831 AssocTypeShorthandResolution :: Resolved ( current_result)
0 commit comments