Skip to content

Commit 670fa9b

Browse files
committed
remove duplicate _ is a reserved lifetime name
Signed-off-by: xizheyin <[email protected]>
1 parent 9306466 commit 670fa9b

File tree

3 files changed

+2
-16
lines changed

3 files changed

+2
-16
lines changed

compiler/rustc_resolve/messages.ftl

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,6 @@ resolve_expected_module_found =
135135
expected module, found {$res} `{$path_str}`
136136
.label = not a module
137137
138-
resolve_explicit_anonymous_lifetime_report_error =
139-
`'_` cannot be used here
140-
.label = `'_` is a reserved lifetime name
141-
142138
resolve_explicit_unsafe_traits =
143139
unsafe traits like `{$ident}` should be implemented explicitly
144140

compiler/rustc_resolve/src/errors.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -915,14 +915,6 @@ pub(crate) struct ElidedAnonymousLivetimeReportErrorSuggestion {
915915
pub(crate) hi: Span,
916916
}
917917

918-
#[derive(Diagnostic)]
919-
#[diag(resolve_explicit_anonymous_lifetime_report_error, code = E0637)]
920-
pub(crate) struct ExplicitAnonymousLivetimeReportError {
921-
#[primary_span]
922-
#[label]
923-
pub(crate) span: Span,
924-
}
925-
926918
#[derive(Diagnostic)]
927919
#[diag(resolve_implicit_elided_lifetimes_not_allowed_here, code = E0726)]
928920
pub(crate) struct ImplicitElidedLifetimeNotAllowedHere {

compiler/rustc_resolve/src/late.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1929,9 +1929,7 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
19291929
});
19301930
}
19311931
} else {
1932-
self.r.dcx().emit_err(errors::ExplicitAnonymousLivetimeReportError {
1933-
span: lifetime.ident.span,
1934-
});
1932+
self.r.dcx().emit_err(errors::UnderscoreLifetimeIsReserved { span: lifetime.ident.span });
19351933
};
19361934
self.record_lifetime_res(lifetime.id, LifetimeRes::Error, elision_candidate);
19371935
return;
@@ -2905,7 +2903,7 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
29052903
if param.ident.name == kw::UnderscoreLifetime {
29062904
self.r
29072905
.dcx()
2908-
.emit_err(errors::UnderscoreLifetimeIsReserved { span: param.ident.span });
2906+
.emit_err(errors::UnderscoreLifetimeIsReserved { span: param.ident.span });
29092907
// Record lifetime res, so lowering knows there is something fishy.
29102908
self.record_lifetime_param(param.id, LifetimeRes::Error);
29112909
continue;

0 commit comments

Comments
 (0)