@@ -382,7 +382,7 @@ impl<'a> TyLoweringContext<'a> {
382
382
list_params,
383
383
const_params,
384
384
_impl_trait_params,
385
- lifetime_params ,
385
+ _lifetime_params ,
386
386
) = if let Some ( def) = self . resolver . generic_def ( ) {
387
387
let generics = generics ( self . db . upcast ( ) , def) ;
388
388
generics. provenance_split ( )
@@ -391,11 +391,7 @@ impl<'a> TyLoweringContext<'a> {
391
391
} ;
392
392
TyKind :: BoundVar ( BoundVar :: new (
393
393
self . in_binders ,
394
- idx as usize
395
- + self_params
396
- + list_params
397
- + const_params
398
- + lifetime_params,
394
+ idx as usize + self_params + list_params + const_params,
399
395
) )
400
396
. intern ( Interner )
401
397
}
@@ -869,11 +865,17 @@ impl<'a> TyLoweringContext<'a> {
869
865
let expected_num = if generic_args. has_self_type {
870
866
self_params + type_params + const_params + lifetime_params
871
867
} else {
872
- type_params + const_params
868
+ type_params + const_params + lifetime_params
873
869
} ;
874
870
let skip = if generic_args. has_self_type && self_params == 0 { 1 } else { 0 } ;
875
871
// if args are provided, it should be all of them, but we can't rely on that
876
- for arg in generic_args. args . iter ( ) . skip ( skip) . take ( expected_num) {
872
+ for arg in generic_args
873
+ . args
874
+ . iter ( )
875
+ . filter ( |arg| !matches ! ( arg, GenericArg :: Lifetime ( _) ) )
876
+ . skip ( skip)
877
+ . take ( expected_num)
878
+ {
877
879
if let Some ( id) = def_generic_iter. next ( ) {
878
880
if let Some ( x) = generic_arg_to_chalk (
879
881
self . db ,
@@ -892,6 +894,34 @@ impl<'a> TyLoweringContext<'a> {
892
894
}
893
895
}
894
896
}
897
+
898
+ for arg in generic_args
899
+ . args
900
+ . iter ( )
901
+ . filter ( |arg| matches ! ( arg, GenericArg :: Lifetime ( _) ) )
902
+ . skip ( skip)
903
+ . take ( expected_num)
904
+ {
905
+ // Taking into the fact that def_generic_iter will always have lifetimes at the end
906
+ // Should have some test cases tho to test this behaviour more properly
907
+ if let Some ( id) = def_generic_iter. next ( ) {
908
+ if let Some ( x) = generic_arg_to_chalk (
909
+ self . db ,
910
+ id,
911
+ arg,
912
+ & mut ( ) ,
913
+ |_, type_ref| self . lower_ty ( type_ref) ,
914
+ |_, const_ref, ty| self . lower_const ( const_ref, ty) ,
915
+ |_, lifetime_ref| self . lower_lifetime ( lifetime_ref) ,
916
+ ) {
917
+ had_explicit_args = true ;
918
+ substs. push ( dbg ! ( x) ) ;
919
+ } else {
920
+ // Never return a None explictly
921
+ never ! ( "Unexpectd None by generic_arg_to_chalk" ) ;
922
+ }
923
+ }
924
+ }
895
925
} else {
896
926
fill_self_params ( ) ;
897
927
}
0 commit comments