mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-04 19:29:07 +00:00
Auto merge of #35362 - medzin:E0252, r=GuillaumeGomez
Updated error message E0252 Fixes #35306 as part of #35233. r? @GuillaumeGomez
This commit is contained in:
commit
f5e7a5910d
@ -3375,7 +3375,11 @@ impl<'a> Resolver<'a> {
|
|||||||
(true, _) | (_, true) => struct_span_err!(self.session, span, E0260, "{}", msg),
|
(true, _) | (_, true) => struct_span_err!(self.session, span, E0260, "{}", msg),
|
||||||
_ => match (old_binding.is_import(), binding.is_import()) {
|
_ => match (old_binding.is_import(), binding.is_import()) {
|
||||||
(false, false) => struct_span_err!(self.session, span, E0428, "{}", msg),
|
(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);
|
let mut e = struct_span_err!(self.session, span, E0255, "{}", msg);
|
||||||
e.span_label(span, &format!("`{}` was already imported", name));
|
e.span_label(span, &format!("`{}` was already imported", name));
|
||||||
|
@ -7,8 +7,6 @@
|
|||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
#![feature(no_core)]
|
|
||||||
#![no_core]
|
|
||||||
|
|
||||||
// This tests that conflicting imports shows both `use` lines
|
// This tests that conflicting imports shows both `use` lines
|
||||||
// when reporting the error.
|
// when reporting the error.
|
||||||
@ -23,5 +21,6 @@ mod sub2 {
|
|||||||
|
|
||||||
use sub1::foo; //~ NOTE previous import of `foo` here
|
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]
|
use sub2::foo; //~ ERROR a value named `foo` has already been imported in this module [E0252]
|
||||||
|
//~| NOTE already imported
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
@ -11,7 +11,9 @@
|
|||||||
use std::sync::{self, Arc}; //~ NOTE previous import
|
use std::sync::{self, Arc}; //~ NOTE previous import
|
||||||
//~^ NOTE previous import
|
//~^ NOTE previous import
|
||||||
use std::sync::Arc; //~ ERROR a type named
|
use std::sync::Arc; //~ ERROR a type named
|
||||||
|
//~| NOTE already imported
|
||||||
use std::sync; //~ ERROR a module named
|
use std::sync; //~ ERROR a module named
|
||||||
|
//~| NOTE already imported
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,8 @@ use foo::bar::{
|
|||||||
Bar,
|
Bar,
|
||||||
self
|
self
|
||||||
//~^ NOTE another `self` import appears here
|
//~^ NOTE another `self` import appears here
|
||||||
//~^^ ERROR a module named `bar` has already been imported in this module
|
//~| ERROR a module named `bar` has already been imported in this module
|
||||||
|
//~| NOTE already imported
|
||||||
};
|
};
|
||||||
|
|
||||||
use {self};
|
use {self};
|
||||||
|
Loading…
Reference in New Issue
Block a user