Skip to content

Commit

Permalink
E0263 updated to new format. #35518
Browse files Browse the repository at this point in the history
  • Loading branch information
Jakub Hlusička committed Aug 9, 2016
1 parent f013914 commit 46265a0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
12 changes: 8 additions & 4 deletions src/librustc/middle/resolve_lifetime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -718,10 +718,14 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
let lifetime_j = &lifetimes[j];

if lifetime_i.lifetime.name == lifetime_j.lifetime.name {
span_err!(self.sess, lifetime_j.lifetime.span, E0263,
"lifetime name `{}` declared twice in \
the same scope",
lifetime_j.lifetime.name);
struct_span_err!(self.sess, lifetime_j.lifetime.span, E0263,
"lifetime name `{}` declared twice in the same scope",
lifetime_j.lifetime.name)
.span_label(lifetime_j.lifetime.span,
&format!("declared twice"))
.span_label(lifetime_i.lifetime.span,
&format!("previous declaration here"))
.emit();
}
}

Expand Down
6 changes: 5 additions & 1 deletion src/test/compile-fail/E0263.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

fn foo<'a, 'b, 'a>(x: &'a str, y: &'b str) { } //~ ERROR E0263
fn foo<'a, 'b, 'a>(x: &'a str, y: &'b str) {
//~^ ERROR E0263
//~| NOTE declared twice
//~| NOTE previous declaration here
}

fn main() {}

0 comments on commit 46265a0

Please sign in to comment.