This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +21
-2
lines changed
ide/src/syntax_highlighting Expand file tree Collapse file tree 2 files changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -644,7 +644,8 @@ pub fn is_dyn_method(
644
644
let ItemContainerId :: TraitId ( trait_id) = func. lookup ( db. upcast ( ) ) . container else {
645
645
return None ;
646
646
} ;
647
- let trait_params = db. generic_params ( trait_id. into ( ) ) . type_or_consts . len ( ) ;
647
+ let generic_params = db. generic_params ( trait_id. into ( ) ) ;
648
+ let trait_params = generic_params. type_or_consts . len ( ) + generic_params. lifetimes . len ( ) ;
648
649
let fn_params = fn_subst. len ( Interner ) - trait_params;
649
650
let trait_ref = TraitRef {
650
651
trait_id : to_chalk_trait_id ( trait_id) ,
@@ -686,7 +687,8 @@ pub(crate) fn lookup_impl_method_query(
686
687
let ItemContainerId :: TraitId ( trait_id) = func. lookup ( db. upcast ( ) ) . container else {
687
688
return ( func, fn_subst) ;
688
689
} ;
689
- let trait_params = db. generic_params ( trait_id. into ( ) ) . type_or_consts . len ( ) ;
690
+ let generic_params = db. generic_params ( trait_id. into ( ) ) ;
691
+ let trait_params = generic_params. type_or_consts . len ( ) + generic_params. lifetimes . len ( ) ;
690
692
let fn_params = fn_subst. len ( Interner ) - trait_params;
691
693
let trait_ref = TraitRef {
692
694
trait_id : to_chalk_trait_id ( trait_id) ,
Original file line number Diff line number Diff line change @@ -1229,3 +1229,20 @@ fn benchmark_syntax_highlighting_parser() {
1229
1229
} ;
1230
1230
assert_eq ! ( hash, 1169 ) ;
1231
1231
}
1232
+
1233
+ #[ test]
1234
+ fn highlight_trait_with_lifetimes_regression_16958 ( ) {
1235
+ let ( analysis, file_id) = fixture:: file (
1236
+ r#"
1237
+ pub trait Deserialize<'de> {
1238
+ fn deserialize();
1239
+ }
1240
+
1241
+ fn f<'de, T: Deserialize<'de>>() {
1242
+ T::deserialize();
1243
+ }
1244
+ "#
1245
+ . trim ( ) ,
1246
+ ) ;
1247
+ let _ = analysis. highlight ( HL_CONFIG , file_id) . unwrap ( ) ;
1248
+ }
You can’t perform that action at this time.
0 commit comments