Skip to content

Commit

Permalink
Update E0261 and E0262 to new error format
Browse files Browse the repository at this point in the history
  • Loading branch information
creativcoder committed Aug 10, 2016
1 parent f013914 commit f581d52
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/librustc/middle/resolve_lifetime.rs
Expand Up @@ -697,9 +697,10 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
}

fn unresolved_lifetime_ref(&self, lifetime_ref: &hir::Lifetime) {
span_err!(self.sess, lifetime_ref.span, E0261,
"use of undeclared lifetime name `{}`",
lifetime_ref.name);
struct_span_err!(self.sess, lifetime_ref.span, E0261,
"use of undeclared lifetime name `{}`", lifetime_ref.name)
.span_label(lifetime_ref.span, &format!("undeclared lifetime"))
.emit();
}

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

for lifetime in lifetimes {
if lifetime.lifetime.name == keywords::StaticLifetime.name() {
span_err!(self.sess, lifetime.lifetime.span, E0262,
"invalid lifetime parameter name: `{}`", lifetime.lifetime.name);
let lifetime = lifetime.lifetime;
let mut err = struct_span_err!(self.sess, lifetime.span, E0262,
"invalid lifetime parameter name: `{}`", lifetime.name);
err.span_label(lifetime.span,
&format!("{} is a reserved lifetime name", lifetime.name));
err.emit();
}
}

Expand Down

0 comments on commit f581d52

Please sign in to comment.