This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +45
-0
lines changed
compiler/rustc_resolve/src/late Expand file tree Collapse file tree 3 files changed +45
-0
lines changed Original file line number Diff line number Diff line change @@ -1962,6 +1962,8 @@ impl<'tcx> LifetimeContext<'_, 'tcx> {
19621962 hir:: GenericParamKind :: Type {
19631963 synthetic: Some ( hir:: SyntheticTyParamKind :: ImplTrait ) ,
19641964 ..
1965+ } | hir:: GenericParamKind :: Lifetime {
1966+ kind: hir:: LifetimeParamKind :: Elided
19651967 }
19661968 )
19671969 } ) {
Original file line number Diff line number Diff line change 1+ // Regression test for #86667, where a garbled suggestion was issued for
2+ // a missing named lifetime parameter.
3+
4+ // compile-flags: --edition 2018
5+
6+ async fn a ( s1 : & str , s2 : & str ) -> & str {
7+ //~^ ERROR: missing lifetime specifier [E0106]
8+ s1
9+ }
10+
11+ fn b ( s1 : & str , s2 : & str ) -> & str {
12+ //~^ ERROR: missing lifetime specifier [E0106]
13+ s1
14+ }
15+
16+ fn main ( ) { }
Original file line number Diff line number Diff line change 1+ error[E0106]: missing lifetime specifier
2+ --> $DIR/issue-86667.rs:6:35
3+ |
4+ LL | async fn a(s1: &str, s2: &str) -> &str {
5+ | ---- ---- ^ expected named lifetime parameter
6+ |
7+ = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from `s1` or `s2`
8+ help: consider introducing a named lifetime parameter
9+ |
10+ LL | async fn a<'a>(s1: &'a str, s2: &'a str) -> &'a str {
11+ | ^^^^ ^^^^^^^ ^^^^^^^ ^^^
12+
13+ error[E0106]: missing lifetime specifier
14+ --> $DIR/issue-86667.rs:11:29
15+ |
16+ LL | fn b(s1: &str, s2: &str) -> &str {
17+ | ---- ---- ^ expected named lifetime parameter
18+ |
19+ = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from `s1` or `s2`
20+ help: consider introducing a named lifetime parameter
21+ |
22+ LL | fn b<'a>(s1: &'a str, s2: &'a str) -> &'a str {
23+ | ^^^^ ^^^^^^^ ^^^^^^^ ^^^
24+
25+ error: aborting due to 2 previous errors
26+
27+ For more information about this error, try `rustc --explain E0106`.
You can’t perform that action at this time.
0 commit comments