File tree 1 file changed +19
-1
lines changed
src/tools/rust-analyzer/crates/ide/src/inlay_hints
1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -389,7 +389,9 @@ fn hints_(
389
389
}
390
390
( None , allocated_lifetimes) => on_missing_gpl ( acc, allocated_lifetimes) ,
391
391
}
392
- ctx. lifetime_stacks . last_mut ( ) . unwrap ( ) . extend ( allocated_lifetimes) ;
392
+ if let Some ( stack) = ctx. lifetime_stacks . last_mut ( ) {
393
+ stack. extend ( allocated_lifetimes) ;
394
+ }
393
395
Some ( ( ) )
394
396
}
395
397
@@ -542,6 +544,22 @@ fn fn_trait(a: &impl Fn(&()) -> &()) {}
542
544
// ^^ for<'1>
543
545
//^'1
544
546
// ^'1
547
+ "# ,
548
+ ) ;
549
+ }
550
+
551
+ #[ test]
552
+ fn hints_in_non_gen_defs ( ) {
553
+ check_with_config (
554
+ InlayHintsConfig {
555
+ lifetime_elision_hints : LifetimeElisionHints :: Always ,
556
+ ..TEST_CONFIG
557
+ } ,
558
+ r#"
559
+ const _: fn(&()) -> &();
560
+ //^^ for<'0>
561
+ //^'0
562
+ //^'0
545
563
"# ,
546
564
) ;
547
565
}
You can’t perform that action at this time.
0 commit comments