File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed
crates/ide/src/inlay_hints Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -389,7 +389,9 @@ fn hints_(
389389 }
390390 ( None , allocated_lifetimes) => on_missing_gpl ( acc, allocated_lifetimes) ,
391391 }
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+ }
393395 Some ( ( ) )
394396}
395397
@@ -542,6 +544,22 @@ fn fn_trait(a: &impl Fn(&()) -> &()) {}
542544 // ^^ for<'1>
543545 //^'1
544546 // ^'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
545563"# ,
546564 ) ;
547565 }
You can’t perform that action at this time.
0 commit comments