Skip to content

Commit c75fd78

Browse files
author
Jonathan Turner
authored
Rollup merge of rust-lang#35773 - EugeneGonzalez:master, r=jonathandturner
Change E0259 to the new error format Fixes rust-lang#35514 as part of rust-lang#35233. Sorry about creating a new PR I was having a lot of troubles squashing the commit because I didn't properly branch the new feature. r? @GuillaumeGomez
2 parents 7a187c3 + d4ca561 commit c75fd78

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/librustc_resolve/lib.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3349,7 +3349,11 @@ impl<'a> Resolver<'a> {
33493349
};
33503350

33513351
let mut err = match (old_binding.is_extern_crate(), binding.is_extern_crate()) {
3352-
(true, true) => struct_span_err!(self.session, span, E0259, "{}", msg),
3352+
(true, true) => {
3353+
let mut e = struct_span_err!(self.session, span, E0259, "{}", msg);
3354+
e.span_label(span, &format!("`{}` was already imported", name));
3355+
e
3356+
},
33533357
(true, _) | (_, true) if binding.is_import() || old_binding.is_import() => {
33543358
let mut e = struct_span_err!(self.session, span, E0254, "{}", msg);
33553359
e.span_label(span, &"already imported");

src/test/compile-fail/E0259.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99
// except according to those terms.
1010

1111
extern crate collections;
12-
extern crate libc as collections; //~ ERROR E0259
12+
//~^ NOTE previous import of `collections` here
13+
14+
extern crate libc as collections;
15+
//~^ ERROR E0259
16+
//~| NOTE `collections` was already imported
1317

1418
fn main() {}

0 commit comments

Comments
 (0)