Skip to content

Commit aaed538

Browse files
author
Jonathan Turner
authored
Rollup merge of rust-lang#35557 - Limeth:master, r=jonathandturner
E0263 updated to new format. Fixes rust-lang#35518. Part of rust-lang#35233. r? @jonathandturner
2 parents a5408a5 + 46265a0 commit aaed538

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

src/librustc/middle/resolve_lifetime.rs

+8-4
Original file line numberDiff line numberDiff line change
@@ -718,10 +718,14 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
718718
let lifetime_j = &lifetimes[j];
719719

720720
if lifetime_i.lifetime.name == lifetime_j.lifetime.name {
721-
span_err!(self.sess, lifetime_j.lifetime.span, E0263,
722-
"lifetime name `{}` declared twice in \
723-
the same scope",
724-
lifetime_j.lifetime.name);
721+
struct_span_err!(self.sess, lifetime_j.lifetime.span, E0263,
722+
"lifetime name `{}` declared twice in the same scope",
723+
lifetime_j.lifetime.name)
724+
.span_label(lifetime_j.lifetime.span,
725+
&format!("declared twice"))
726+
.span_label(lifetime_i.lifetime.span,
727+
&format!("previous declaration here"))
728+
.emit();
725729
}
726730
}
727731

src/test/compile-fail/E0263.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
fn foo<'a, 'b, 'a>(x: &'a str, y: &'b str) { } //~ ERROR E0263
11+
fn foo<'a, 'b, 'a>(x: &'a str, y: &'b str) {
12+
//~^ ERROR E0263
13+
//~| NOTE declared twice
14+
//~| NOTE previous declaration here
15+
}
1216

1317
fn main() {}

0 commit comments

Comments
 (0)