Skip to content

Commit f581d52

Browse files
committed
Update E0261 and E0262 to new error format
1 parent f013914 commit f581d52

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/librustc/middle/resolve_lifetime.rs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -697,9 +697,10 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
697697
}
698698

699699
fn unresolved_lifetime_ref(&self, lifetime_ref: &hir::Lifetime) {
700-
span_err!(self.sess, lifetime_ref.span, E0261,
701-
"use of undeclared lifetime name `{}`",
702-
lifetime_ref.name);
700+
struct_span_err!(self.sess, lifetime_ref.span, E0261,
701+
"use of undeclared lifetime name `{}`", lifetime_ref.name)
702+
.span_label(lifetime_ref.span, &format!("undeclared lifetime"))
703+
.emit();
703704
}
704705

705706
fn check_lifetime_defs(&mut self, old_scope: Scope, lifetimes: &[hir::LifetimeDef]) {
@@ -708,8 +709,12 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
708709

709710
for lifetime in lifetimes {
710711
if lifetime.lifetime.name == keywords::StaticLifetime.name() {
711-
span_err!(self.sess, lifetime.lifetime.span, E0262,
712-
"invalid lifetime parameter name: `{}`", lifetime.lifetime.name);
712+
let lifetime = lifetime.lifetime;
713+
let mut err = struct_span_err!(self.sess, lifetime.span, E0262,
714+
"invalid lifetime parameter name: `{}`", lifetime.name);
715+
err.span_label(lifetime.span,
716+
&format!("{} is a reserved lifetime name", lifetime.name));
717+
err.emit();
713718
}
714719
}
715720

0 commit comments

Comments
 (0)