File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1809,8 +1809,12 @@ fn resolve_type_param_assoc_type_shorthand(
18091809 return AssocTypeShorthandResolution :: Ambiguous {
18101810 sub_trait_resolution : Some ( this_trait_resolution) ,
18111811 } ;
1812- } else if supertraits_resolution. is_some ( ) {
1813- return AssocTypeShorthandResolution :: Ambiguous { sub_trait_resolution : None } ;
1812+ } 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 {
1816+ continue ;
1817+ }
18141818 } else {
18151819 let ( assoc_type, args) = assoc_type_and_args
18161820 . get_with ( |( assoc_type, args) | ( * assoc_type, args. as_ref ( ) ) )
Original file line number Diff line number Diff line change @@ -2815,3 +2815,28 @@ fn contains_0<S: Collection<Item = i32>>(points: &S) {
28152815 "# ,
28162816 ) ;
28172817}
2818+
2819+ #[ test]
2820+ fn regression_21773 ( ) {
2821+ check_no_mismatches (
2822+ r#"
2823+ trait Neg {
2824+ type Output;
2825+ }
2826+
2827+ trait Abs: Neg {
2828+ fn abs(&self) -> Self::Output;
2829+ }
2830+
2831+ trait SelfAbs: Abs + Neg
2832+ where
2833+ Self::Output: Neg<Output = Self::Output> + Abs,
2834+ {
2835+ }
2836+
2837+ fn wrapped_abs<T: SelfAbs<Output = T>>(v: T) -> T {
2838+ v.abs()
2839+ }
2840+ "# ,
2841+ ) ;
2842+ }
You can’t perform that action at this time.
0 commit comments