Skip to content

Commit

Permalink
Updated error message E0252
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam Medziński committed Aug 5, 2016
1 parent 802d081 commit ef23c94
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/librustc_resolve/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3367,7 +3367,11 @@ impl<'a> Resolver<'a> {
(true, _) | (_, true) => struct_span_err!(self.session, span, E0260, "{}", msg),
_ => match (old_binding.is_import(), binding.is_import()) {
(false, false) => struct_span_err!(self.session, span, E0428, "{}", msg),
(true, true) => struct_span_err!(self.session, span, E0252, "{}", msg),
(true, true) => {
let mut e = struct_span_err!(self.session, span, E0252, "{}", msg);
e.span_label(span, &format!("already imported"));
e
},
_ => {
let mut e = struct_span_err!(self.session, span, E0255, "{}", msg);
e.span_label(span, &format!("`{}` was already imported", name));
Expand Down
3 changes: 1 addition & 2 deletions src/test/compile-fail/double-import.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(no_core)]
#![no_core]

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

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

fn main() {}

0 comments on commit ef23c94

Please sign in to comment.