File tree Expand file tree Collapse file tree 2 files changed +27
-1
lines changed
src/tools/rust-analyzer/crates/hir-ty/src Expand file tree Collapse file tree 2 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -637,7 +637,10 @@ pub(crate) fn associated_ty_data_query(
637
637
. fill_with_bound_vars ( crate :: DebruijnIndex :: INNERMOST , 0 )
638
638
. build ( ) ;
639
639
let pro_ty = TyBuilder :: assoc_type_projection ( db, type_alias, Some ( trait_subst) )
640
- . fill_with_bound_vars ( crate :: DebruijnIndex :: INNERMOST , generic_params. len_self ( ) )
640
+ . fill_with_bound_vars (
641
+ crate :: DebruijnIndex :: INNERMOST ,
642
+ generic_params. parent_generics ( ) . map_or ( 0 , |it| it. len ( ) ) ,
643
+ )
641
644
. build ( ) ;
642
645
let self_ty = TyKind :: Alias ( AliasTy :: Projection ( pro_ty) ) . intern ( Interner ) ;
643
646
Original file line number Diff line number Diff line change @@ -2278,3 +2278,26 @@ fn test(x: bool) {
2278
2278
"# ] ] ,
2279
2279
) ;
2280
2280
}
2281
+
2282
+ #[ test]
2283
+ fn issue_19730 ( ) {
2284
+ check_infer (
2285
+ r#"
2286
+ trait Trait<T = Self> {}
2287
+
2288
+ trait Foo {
2289
+ type Bar<A, B>: Trait;
2290
+
2291
+ fn foo<A, B>(bar: Self::Bar<A, B>) {
2292
+ let _ = bar;
2293
+ }
2294
+ }
2295
+ "# ,
2296
+ expect ! [ [ r#"
2297
+ 83..86 'bar': Foo::Bar<Self, A, B>
2298
+ 105..133 '{ ... }': ()
2299
+ 119..120 '_': Foo::Bar<Self, A, B>
2300
+ 123..126 'bar': Foo::Bar<Self, A, B>
2301
+ "# ] ] ,
2302
+ ) ;
2303
+ }
You can’t perform that action at this time.
0 commit comments