Skip to content

Commit f4dd1f9

Browse files
author
Adam Medziński
committed
Updated error message E0252
1 parent 802d081 commit f4dd1f9

File tree

4 files changed

+10
-4
lines changed

4 files changed

+10
-4
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() {}

src/test/compile-fail/issue-26886.rs

+2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
use std::sync::{self, Arc}; //~ NOTE previous import
1212
//~^ NOTE previous import
1313
use std::sync::Arc; //~ ERROR a type named
14+
//~| NOTE already imported
1415
use std::sync; //~ ERROR a module named
16+
//~| NOTE already imported
1517

1618
fn main() {
1719
}

src/test/compile-fail/use-mod.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ use foo::bar::{
1515
Bar,
1616
self
1717
//~^ NOTE another `self` import appears here
18-
//~^^ ERROR a module named `bar` has already been imported in this module
18+
//~| ERROR a module named `bar` has already been imported in this module
19+
//~| NOTE already imported
1920
};
2021

2122
use {self};

0 commit comments

Comments
 (0)