Skip to content

Commit 073cbb6

Browse files
authored
Auto merge of #35362 - medzin:E0252, r=GuillaumeGomez
Updated error message E0252 Fixes #35306 as part of #35233. r? @GuillaumeGomez
2 parents 4c02363 + ef23c94 commit 073cbb6

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/librustc_resolve/lib.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -3367,7 +3367,11 @@ impl<'a> Resolver<'a> {
33673367
(true, _) | (_, true) => struct_span_err!(self.session, span, E0260, "{}", msg),
33683368
_ => match (old_binding.is_import(), binding.is_import()) {
33693369
(false, false) => struct_span_err!(self.session, span, E0428, "{}", msg),
3370-
(true, true) => struct_span_err!(self.session, span, E0252, "{}", msg),
3370+
(true, true) => {
3371+
let mut e = struct_span_err!(self.session, span, E0252, "{}", msg);
3372+
e.span_label(span, &format!("already imported"));
3373+
e
3374+
},
33713375
_ => {
33723376
let mut e = struct_span_err!(self.session, span, E0255, "{}", msg);
33733377
e.span_label(span, &format!("`{}` was already imported", name));

src/test/compile-fail/double-import.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
10-
#![feature(no_core)]
11-
#![no_core]
1210

1311
// This tests that conflicting imports shows both `use` lines
1412
// when reporting the error.
@@ -23,5 +21,6 @@ mod sub2 {
2321

2422
use sub1::foo; //~ NOTE previous import of `foo` here
2523
use sub2::foo; //~ ERROR a value named `foo` has already been imported in this module [E0252]
24+
//~| NOTE already imported
2625

2726
fn main() {}

0 commit comments

Comments
 (0)