Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions compiler/rustc_resolve/messages.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,7 @@ resolve_undeclared_label =

resolve_underscore_lifetime_is_reserved = `'_` cannot be used here
.label = `'_` is a reserved lifetime name
.help = use another lifetime specifier

resolve_unexpected_res_change_ty_to_const_param_sugg =
you might have meant to write a const parameter here
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_resolve/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -934,6 +934,7 @@ pub(crate) struct ImplicitElidedLifetimeNotAllowedHere {

#[derive(Diagnostic)]
#[diag(resolve_underscore_lifetime_is_reserved, code = E0637)]
#[help]
pub(crate) struct UnderscoreLifetimeIsReserved {
#[primary_span]
#[label]
Expand Down
2 changes: 2 additions & 0 deletions tests/ui/error-codes/E0637.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ error[E0637]: `'_` cannot be used here
|
LL | fn underscore_lifetime<'_>(str1: &'_ str, str2: &'_ str) -> &'_ str {
| ^^ `'_` is a reserved lifetime name
|
= help: use another lifetime specifier

error[E0106]: missing lifetime specifier
--> $DIR/E0637.rs:1:62
Expand Down
12 changes: 12 additions & 0 deletions tests/ui/underscore-lifetime/in-binder.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,48 @@ error[E0637]: `'_` cannot be used here
|
LL | impl<'_> IceCube<'_> {}
| ^^ `'_` is a reserved lifetime name
|
= help: use another lifetime specifier

error[E0637]: `'_` cannot be used here
--> $DIR/in-binder.rs:12:15
|
LL | struct Struct<'_> {
| ^^ `'_` is a reserved lifetime name
|
= help: use another lifetime specifier

error[E0637]: `'_` cannot be used here
--> $DIR/in-binder.rs:17:11
|
LL | enum Enum<'_> {
| ^^ `'_` is a reserved lifetime name
|
= help: use another lifetime specifier

error[E0637]: `'_` cannot be used here
--> $DIR/in-binder.rs:22:13
|
LL | union Union<'_> {
| ^^ `'_` is a reserved lifetime name
|
= help: use another lifetime specifier

error[E0637]: `'_` cannot be used here
--> $DIR/in-binder.rs:27:13
|
LL | trait Trait<'_> {
| ^^ `'_` is a reserved lifetime name
|
= help: use another lifetime specifier

error[E0637]: `'_` cannot be used here
--> $DIR/in-binder.rs:31:8
|
LL | fn foo<'_>() {
| ^^ `'_` is a reserved lifetime name
|
= help: use another lifetime specifier

error: aborting due to 6 previous errors

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,16 @@ error[E0637]: `'_` cannot be used here
|
LL | fn foo<'_>
| ^^ `'_` is a reserved lifetime name
|
= help: use another lifetime specifier

error[E0637]: `'_` cannot be used here
--> $DIR/underscore-lifetime-binders.rs:10:25
|
LL | fn meh() -> Box<dyn for<'_> Meh<'_>>
| ^^ `'_` is a reserved lifetime name
|
= help: use another lifetime specifier

error[E0106]: missing lifetime specifier
--> $DIR/underscore-lifetime-binders.rs:10:33
Expand Down
Loading