Auto merge of #55113 - mockersf:master, r=estebank
#45829 when a renamed import conflict with a previous import Fix the suggestion when a renamed import conflict. It check if the snipped contains `" as "`, and if so uses everything before for the suggestion.
This commit is contained in:
commit
7cfe5de214
57 changed files with 484 additions and 81 deletions
|
|
@ -7,7 +7,7 @@ LL | use foo::Bar;
|
|||
| ^^^^^^^^ `Bar` reimported here
|
||||
|
|
||||
= note: `Bar` must be defined only once in the type namespace of this block
|
||||
help: You can use `as` to change the binding name of the import
|
||||
help: you can use `as` to change the binding name of the import
|
||||
|
|
||||
LL | use foo::Bar as OtherBar;
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ LL | use foo::foo;
|
|||
| ^^^^^^^^ `foo` reimported here
|
||||
|
|
||||
= note: `foo` must be defined only once in the type namespace of this module
|
||||
help: You can use `as` to change the binding name of the import
|
||||
help: you can use `as` to change the binding name of the import
|
||||
|
|
||||
LL | use foo::foo as other_foo;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ LL | use sub2::foo; //~ ERROR the name `foo` is defined multiple times
|
|||
| ^^^^^^^^^ `foo` reimported here
|
||||
|
|
||||
= note: `foo` must be defined only once in the value namespace of this module
|
||||
help: You can use `as` to change the binding name of the import
|
||||
help: you can use `as` to change the binding name of the import
|
||||
|
|
||||
LL | use sub2::foo as other_foo; //~ ERROR the name `foo` is defined multiple times
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ LL | use self::bar::X;
|
|||
| ^^^^^^^^^^^^ `X` reimported here
|
||||
|
|
||||
= note: `X` must be defined only once in the type namespace of this module
|
||||
help: You can use `as` to change the binding name of the import
|
||||
help: you can use `as` to change the binding name of the import
|
||||
|
|
||||
LL | use self::bar::X as OtherX;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ LL | macro_rules! panic { () => {} } //~ ERROR the name `panic` is defined multi
|
|||
| ^^^^^^^^^^^^^^^^^^ `panic` redefined here
|
||||
|
|
||||
= note: `panic` must be defined only once in the macro namespace of this module
|
||||
help: You can use `as` to change the binding name of the import
|
||||
help: you can use `as` to change the binding name of the import
|
||||
|
|
||||
LL | pub use std::panic as other_panic;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ LL | use bar::baz; //~ ERROR E0252
|
|||
| ^^^^^^^^ `baz` reimported here
|
||||
|
|
||||
= note: `baz` must be defined only once in the type namespace of this module
|
||||
help: You can use `as` to change the binding name of the import
|
||||
help: you can use `as` to change the binding name of the import
|
||||
|
|
||||
LL | use bar::baz as other_baz; //~ ERROR E0252
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ LL | use foo::alloc;
|
|||
| ^^^^^^^^^^ `alloc` reimported here
|
||||
|
|
||||
= note: `alloc` must be defined only once in the type namespace of this module
|
||||
help: You can use `as` to change the binding name of the import
|
||||
help: you can use `as` to change the binding name of the import
|
||||
|
|
||||
LL | use foo::alloc as other_alloc;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ LL | fn foo() {} //~ ERROR E0255
|
|||
| ^^^^^^^^ `foo` redefined here
|
||||
|
|
||||
= note: `foo` must be defined only once in the value namespace of this module
|
||||
help: You can use `as` to change the binding name of the import
|
||||
help: you can use `as` to change the binding name of the import
|
||||
|
|
||||
LL | use bar::foo as other_foo;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
|
|||
|
|
@ -5,12 +5,13 @@ LL | extern crate alloc;
|
|||
| ------------------- previous import of the extern crate `alloc` here
|
||||
LL |
|
||||
LL | extern crate libc as alloc;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
| |
|
||||
| `alloc` reimported here
|
||||
| You can use `as` to change the binding name of the import
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `alloc` reimported here
|
||||
|
|
||||
= note: `alloc` must be defined only once in the type namespace of this module
|
||||
help: you can use `as` to change the binding name of the import
|
||||
|
|
||||
LL | extern crate libc as other_alloc;
|
||||
|
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ LL | mod alloc {
|
|||
| ^^^^^^^^^ `alloc` redefined here
|
||||
|
|
||||
= note: `alloc` must be defined only once in the type namespace of this module
|
||||
help: You can use `as` to change the binding name of the import
|
||||
help: you can use `as` to change the binding name of the import
|
||||
|
|
||||
LL | extern crate alloc as other_alloc;
|
||||
|
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ LL | use std::fmt::{self, self}; //~ ERROR E0430
|
|||
| previous import of the module `fmt` here
|
||||
|
|
||||
= note: `fmt` must be defined only once in the type namespace of this module
|
||||
help: You can use `as` to change the binding name of the import
|
||||
help: you can use `as` to change the binding name of the import
|
||||
|
|
||||
LL | use std::fmt::{self, self as other_fmt}; //~ ERROR E0430
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
|
|||
|
|
@ -4,12 +4,13 @@ error[E0259]: the name `m1` is defined multiple times
|
|||
LL | extern crate m1;
|
||||
| ---------------- previous import of the extern crate `m1` here
|
||||
LL | extern crate m2 as m1; //~ ERROR is defined multiple times
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
| |
|
||||
| `m1` reimported here
|
||||
| You can use `as` to change the binding name of the import
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ `m1` reimported here
|
||||
|
|
||||
= note: `m1` must be defined only once in the type namespace of this module
|
||||
help: you can use `as` to change the binding name of the import
|
||||
|
|
||||
LL | extern crate m2 as other_m1; //~ ERROR is defined multiple times
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ LL | use a::foo; //~ ERROR the name `foo` is defined multiple times
|
|||
| ^^^^^^ `foo` reimported here
|
||||
|
|
||||
= note: `foo` must be defined only once in the value namespace of this module
|
||||
help: You can use `as` to change the binding name of the import
|
||||
help: you can use `as` to change the binding name of the import
|
||||
|
|
||||
LL | use a::foo as other_foo; //~ ERROR the name `foo` is defined multiple times
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ LL | mod A {} //~ ERROR the name `A` is defined multiple times
|
|||
| ^^^^^ `A` redefined here
|
||||
|
|
||||
= note: `A` must be defined only once in the type namespace of this module
|
||||
help: You can use `as` to change the binding name of the import
|
||||
help: you can use `as` to change the binding name of the import
|
||||
|
|
||||
LL | use self::A as OtherA;
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
@ -23,7 +23,7 @@ LL | pub mod B {} //~ ERROR the name `B` is defined multiple times
|
|||
| ^^^^^^^^^ `B` redefined here
|
||||
|
|
||||
= note: `B` must be defined only once in the type namespace of this module
|
||||
help: You can use `as` to change the binding name of the import
|
||||
help: you can use `as` to change the binding name of the import
|
||||
|
|
||||
LL | use self::B as OtherB;
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
@ -37,7 +37,7 @@ LL | mod D {} //~ ERROR the name `D` is defined multiple times
|
|||
| ^^^^^ `D` redefined here
|
||||
|
|
||||
= note: `D` must be defined only once in the type namespace of this module
|
||||
help: You can use `as` to change the binding name of the import
|
||||
help: you can use `as` to change the binding name of the import
|
||||
|
|
||||
LL | use C::D as OtherD;
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ LL | type Add = bool; //~ ERROR the name `Add` is defined multiple times
|
|||
| ^^^^^^^^^^^^^^^^ `Add` redefined here
|
||||
|
|
||||
= note: `Add` must be defined only once in the type namespace of this module
|
||||
help: You can use `as` to change the binding name of the import
|
||||
help: you can use `as` to change the binding name of the import
|
||||
|
|
||||
LL | use std::ops::Add as OtherAdd;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
@ -23,7 +23,7 @@ LL | struct Sub { x: f32 } //~ ERROR the name `Sub` is defined multiple times
|
|||
| ^^^^^^^^^^ `Sub` redefined here
|
||||
|
|
||||
= note: `Sub` must be defined only once in the type namespace of this module
|
||||
help: You can use `as` to change the binding name of the import
|
||||
help: you can use `as` to change the binding name of the import
|
||||
|
|
||||
LL | use std::ops::Sub as OtherSub;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
@ -38,7 +38,7 @@ LL | enum Mul { A, B } //~ ERROR the name `Mul` is defined multiple times
|
|||
| ^^^^^^^^ `Mul` redefined here
|
||||
|
|
||||
= note: `Mul` must be defined only once in the type namespace of this module
|
||||
help: You can use `as` to change the binding name of the import
|
||||
help: you can use `as` to change the binding name of the import
|
||||
|
|
||||
LL | use std::ops::Mul as OtherMul;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
@ -53,7 +53,7 @@ LL | mod Div { } //~ ERROR the name `Div` is defined multiple times
|
|||
| ^^^^^^^ `Div` redefined here
|
||||
|
|
||||
= note: `Div` must be defined only once in the type namespace of this module
|
||||
help: You can use `as` to change the binding name of the import
|
||||
help: you can use `as` to change the binding name of the import
|
||||
|
|
||||
LL | use std::ops::Div as OtherDiv;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
@ -68,7 +68,7 @@ LL | trait Rem { } //~ ERROR the name `Rem` is defined multiple times
|
|||
| ^^^^^^^^^ `Rem` redefined here
|
||||
|
|
||||
= note: `Rem` must be defined only once in the type namespace of this module
|
||||
help: You can use `as` to change the binding name of the import
|
||||
help: you can use `as` to change the binding name of the import
|
||||
|
|
||||
LL | use std::ops::Rem as OtherRem;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ LL | use bar::baz; //~ ERROR the name `baz` is defined multiple times
|
|||
| ^^^^^^^^ `baz` reimported here
|
||||
|
|
||||
= note: `baz` must be defined only once in the type namespace of this module
|
||||
help: You can use `as` to change the binding name of the import
|
||||
help: you can use `as` to change the binding name of the import
|
||||
|
|
||||
LL | use bar::baz as other_baz; //~ ERROR the name `baz` is defined multiple times
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
@ -21,7 +21,7 @@ LL | use bar::Quux; //~ ERROR the name `Quux` is defined multiple times
|
|||
| ^^^^^^^^^ `Quux` reimported here
|
||||
|
|
||||
= note: `Quux` must be defined only once in the type namespace of this module
|
||||
help: You can use `as` to change the binding name of the import
|
||||
help: you can use `as` to change the binding name of the import
|
||||
|
|
||||
LL | use bar::Quux as OtherQuux; //~ ERROR the name `Quux` is defined multiple times
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
@ -35,7 +35,7 @@ LL | use bar::blah; //~ ERROR the name `blah` is defined multiple times
|
|||
| ^^^^^^^^^ `blah` reimported here
|
||||
|
|
||||
= note: `blah` must be defined only once in the type namespace of this module
|
||||
help: You can use `as` to change the binding name of the import
|
||||
help: you can use `as` to change the binding name of the import
|
||||
|
|
||||
LL | use bar::blah as other_blah; //~ ERROR the name `blah` is defined multiple times
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
@ -49,7 +49,7 @@ LL | use bar::WOMP; //~ ERROR the name `WOMP` is defined multiple times
|
|||
| ^^^^^^^^^ `WOMP` reimported here
|
||||
|
|
||||
= note: `WOMP` must be defined only once in the value namespace of this module
|
||||
help: You can use `as` to change the binding name of the import
|
||||
help: you can use `as` to change the binding name of the import
|
||||
|
|
||||
LL | use bar::WOMP as OtherWOMP; //~ ERROR the name `WOMP` is defined multiple times
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ LL | use std::sync::Arc; //~ ERROR the name `Arc` is defined multiple times
|
|||
| ^^^^^^^^^^^^^^ `Arc` reimported here
|
||||
|
|
||||
= note: `Arc` must be defined only once in the type namespace of this module
|
||||
help: You can use `as` to change the binding name of the import
|
||||
help: you can use `as` to change the binding name of the import
|
||||
|
|
||||
LL | use std::sync::Arc as OtherArc; //~ ERROR the name `Arc` is defined multiple times
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
@ -22,7 +22,7 @@ LL | use std::sync; //~ ERROR the name `sync` is defined multiple times
|
|||
| ^^^^^^^^^ `sync` reimported here
|
||||
|
|
||||
= note: `sync` must be defined only once in the type namespace of this module
|
||||
help: You can use `as` to change the binding name of the import
|
||||
help: you can use `as` to change the binding name of the import
|
||||
|
|
||||
LL | use std::sync as other_sync; //~ ERROR the name `sync` is defined multiple times
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ LL | use extension2::ConstructorExtension; //~ ERROR is defined multiple times
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `ConstructorExtension` reimported here
|
||||
|
|
||||
= note: `ConstructorExtension` must be defined only once in the type namespace of this module
|
||||
help: You can use `as` to change the binding name of the import
|
||||
help: you can use `as` to change the binding name of the import
|
||||
|
|
||||
LL | use extension2::ConstructorExtension as OtherConstructorExtension; //~ ERROR is defined multiple times
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ LL | extern crate std;
|
|||
| ^^^^^^^^^^^^^^^^^ `std` reimported here
|
||||
|
|
||||
= note: `std` must be defined only once in the type namespace of this module
|
||||
help: You can use `as` to change the binding name of the import
|
||||
help: you can use `as` to change the binding name of the import
|
||||
|
|
||||
LL | extern crate std as other_std;
|
||||
|
|
||||
|
|
|
|||
11
src/test/ui/issues/issue-45829/auxiliary/issue_45829_a.rs
Normal file
11
src/test/ui/issues/issue-45829/auxiliary/issue_45829_a.rs
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <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.
|
||||
|
||||
pub const FOO: usize = *&0;
|
||||
11
src/test/ui/issues/issue-45829/auxiliary/issue_45829_b.rs
Normal file
11
src/test/ui/issues/issue-45829/auxiliary/issue_45829_b.rs
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <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.
|
||||
|
||||
pub const FOO: usize = *&0;
|
||||
22
src/test/ui/issues/issue-45829/import-self.rs
Normal file
22
src/test/ui/issues/issue-45829/import-self.rs
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <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.
|
||||
|
||||
mod foo {
|
||||
pub struct A;
|
||||
pub struct B;
|
||||
}
|
||||
|
||||
use foo::{self};
|
||||
|
||||
use foo as self;
|
||||
|
||||
use foo::self;
|
||||
|
||||
fn main() {}
|
||||
31
src/test/ui/issues/issue-45829/import-self.stderr
Normal file
31
src/test/ui/issues/issue-45829/import-self.stderr
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
error: expected identifier, found keyword `self`
|
||||
--> $DIR/import-self.rs:18:12
|
||||
|
|
||||
LL | use foo as self;
|
||||
| ^^^^ expected identifier, found keyword
|
||||
|
||||
error[E0429]: `self` imports are only allowed within a { } list
|
||||
--> $DIR/import-self.rs:20:5
|
||||
|
|
||||
LL | use foo::self;
|
||||
| ^^^^^^^^^
|
||||
|
||||
error[E0255]: the name `foo` is defined multiple times
|
||||
--> $DIR/import-self.rs:16:11
|
||||
|
|
||||
LL | mod foo {
|
||||
| ------- previous definition of the module `foo` here
|
||||
...
|
||||
LL | use foo::{self};
|
||||
| ^^^^ `foo` reimported here
|
||||
|
|
||||
= note: `foo` must be defined only once in the type namespace of this module
|
||||
help: you can use `as` to change the binding name of the import
|
||||
|
|
||||
LL | use foo::{self as other_foo};
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
Some errors occurred: E0255, E0429.
|
||||
For more information about an error, try `rustc --explain E0255`.
|
||||
18
src/test/ui/issues/issue-45829/import-twice.rs
Normal file
18
src/test/ui/issues/issue-45829/import-twice.rs
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <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.
|
||||
|
||||
mod foo {
|
||||
pub struct A;
|
||||
pub struct B;
|
||||
}
|
||||
|
||||
use foo::{A, A};
|
||||
|
||||
fn main() {}
|
||||
17
src/test/ui/issues/issue-45829/import-twice.stderr
Normal file
17
src/test/ui/issues/issue-45829/import-twice.stderr
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
error[E0252]: the name `A` is defined multiple times
|
||||
--> $DIR/import-twice.rs:16:14
|
||||
|
|
||||
LL | use foo::{A, A};
|
||||
| - ^ `A` reimported here
|
||||
| |
|
||||
| previous import of the type `A` here
|
||||
|
|
||||
= note: `A` must be defined only once in the type namespace of this module
|
||||
help: you can use `as` to change the binding name of the import
|
||||
|
|
||||
LL | use foo::{A, A as OtherA};
|
||||
| ^^^^^^^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0252`.
|
||||
18
src/test/ui/issues/issue-45829/issue-45829.rs
Normal file
18
src/test/ui/issues/issue-45829/issue-45829.rs
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <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.
|
||||
|
||||
mod foo {
|
||||
pub struct A;
|
||||
pub struct B;
|
||||
}
|
||||
|
||||
use foo::{A, B as A};
|
||||
|
||||
fn main() {}
|
||||
17
src/test/ui/issues/issue-45829/issue-45829.stderr
Normal file
17
src/test/ui/issues/issue-45829/issue-45829.stderr
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
error[E0252]: the name `A` is defined multiple times
|
||||
--> $DIR/issue-45829.rs:16:14
|
||||
|
|
||||
LL | use foo::{A, B as A};
|
||||
| - ^^^^^^ `A` reimported here
|
||||
| |
|
||||
| previous import of the type `A` here
|
||||
|
|
||||
= note: `A` must be defined only once in the type namespace of this module
|
||||
help: you can use `as` to change the binding name of the import
|
||||
|
|
||||
LL | use foo::{A, B as OtherA};
|
||||
| ^^^^^^^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0252`.
|
||||
20
src/test/ui/issues/issue-45829/rename-extern-vs-use.rs
Normal file
20
src/test/ui/issues/issue-45829/rename-extern-vs-use.rs
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <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.
|
||||
|
||||
// aux-build:issue_45829_b.rs
|
||||
|
||||
mod foo {
|
||||
pub mod bar {}
|
||||
}
|
||||
|
||||
use foo::bar;
|
||||
extern crate issue_45829_b as bar;
|
||||
|
||||
fn main() {}
|
||||
17
src/test/ui/issues/issue-45829/rename-extern-vs-use.stderr
Normal file
17
src/test/ui/issues/issue-45829/rename-extern-vs-use.stderr
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
error[E0254]: the name `bar` is defined multiple times
|
||||
--> $DIR/rename-extern-vs-use.rs:18:1
|
||||
|
|
||||
LL | use foo::bar;
|
||||
| -------- previous import of the module `bar` here
|
||||
LL | extern crate issue_45829_b as bar;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `bar` reimported here
|
||||
|
|
||||
= note: `bar` must be defined only once in the type namespace of this module
|
||||
help: you can use `as` to change the binding name of the import
|
||||
|
|
||||
LL | extern crate issue_45829_b as other_bar;
|
||||
|
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0254`.
|
||||
17
src/test/ui/issues/issue-45829/rename-extern-with-tab.rs
Normal file
17
src/test/ui/issues/issue-45829/rename-extern-with-tab.rs
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <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.
|
||||
|
||||
// aux-build:issue_45829_a.rs
|
||||
// aux-build:issue_45829_b.rs
|
||||
|
||||
extern crate issue_45829_a;
|
||||
extern crate issue_45829_b as issue_45829_a;
|
||||
|
||||
fn main() {}
|
||||
17
src/test/ui/issues/issue-45829/rename-extern-with-tab.stderr
Normal file
17
src/test/ui/issues/issue-45829/rename-extern-with-tab.stderr
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
error[E0259]: the name `issue_45829_a` is defined multiple times
|
||||
--> $DIR/rename-extern-with-tab.rs:15:1
|
||||
|
|
||||
LL | extern crate issue_45829_a;
|
||||
| --------------------------- previous import of the extern crate `issue_45829_a` here
|
||||
LL | extern crate issue_45829_b as issue_45829_a;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `issue_45829_a` reimported here
|
||||
|
|
||||
= note: `issue_45829_a` must be defined only once in the type namespace of this module
|
||||
help: you can use `as` to change the binding name of the import
|
||||
|
|
||||
LL | extern crate issue_45829_b as other_issue_45829_a;
|
||||
|
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0259`.
|
||||
17
src/test/ui/issues/issue-45829/rename-extern.rs
Normal file
17
src/test/ui/issues/issue-45829/rename-extern.rs
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <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.
|
||||
|
||||
// aux-build:issue_45829_a.rs
|
||||
// aux-build:issue_45829_b.rs
|
||||
|
||||
extern crate issue_45829_a;
|
||||
extern crate issue_45829_b as issue_45829_a;
|
||||
|
||||
fn main() {}
|
||||
17
src/test/ui/issues/issue-45829/rename-extern.stderr
Normal file
17
src/test/ui/issues/issue-45829/rename-extern.stderr
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
error[E0259]: the name `issue_45829_a` is defined multiple times
|
||||
--> $DIR/rename-extern.rs:15:1
|
||||
|
|
||||
LL | extern crate issue_45829_a;
|
||||
| --------------------------- previous import of the extern crate `issue_45829_a` here
|
||||
LL | extern crate issue_45829_b as issue_45829_a;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `issue_45829_a` reimported here
|
||||
|
|
||||
= note: `issue_45829_a` must be defined only once in the type namespace of this module
|
||||
help: you can use `as` to change the binding name of the import
|
||||
|
|
||||
LL | extern crate issue_45829_b as other_issue_45829_a;
|
||||
|
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0259`.
|
||||
16
src/test/ui/issues/issue-45829/rename-use-vs-extern.rs
Normal file
16
src/test/ui/issues/issue-45829/rename-use-vs-extern.rs
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <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.
|
||||
|
||||
// aux-build:issue_45829_b.rs
|
||||
|
||||
extern crate issue_45829_b;
|
||||
use std as issue_45829_b;
|
||||
|
||||
fn main() {}
|
||||
17
src/test/ui/issues/issue-45829/rename-use-vs-extern.stderr
Normal file
17
src/test/ui/issues/issue-45829/rename-use-vs-extern.stderr
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
error[E0254]: the name `issue_45829_b` is defined multiple times
|
||||
--> $DIR/rename-use-vs-extern.rs:14:5
|
||||
|
|
||||
LL | extern crate issue_45829_b;
|
||||
| --------------------------- previous import of the extern crate `issue_45829_b` here
|
||||
LL | use std as issue_45829_b;
|
||||
| ^^^^^^^^^^^^^^^^^^^^ `issue_45829_b` reimported here
|
||||
|
|
||||
= note: `issue_45829_b` must be defined only once in the type namespace of this module
|
||||
help: you can use `as` to change the binding name of the import
|
||||
|
|
||||
LL | use std as other_issue_45829_b;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0254`.
|
||||
21
src/test/ui/issues/issue-45829/rename-use-with-tabs.rs
Normal file
21
src/test/ui/issues/issue-45829/rename-use-with-tabs.rs
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <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.
|
||||
|
||||
mod foo {
|
||||
pub struct A;
|
||||
|
||||
pub mod bar {
|
||||
pub struct B;
|
||||
}
|
||||
}
|
||||
|
||||
use foo::{A, bar::B as A};
|
||||
|
||||
fn main() {}
|
||||
17
src/test/ui/issues/issue-45829/rename-use-with-tabs.stderr
Normal file
17
src/test/ui/issues/issue-45829/rename-use-with-tabs.stderr
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
error[E0252]: the name `A` is defined multiple times
|
||||
--> $DIR/rename-use-with-tabs.rs:19:14
|
||||
|
|
||||
LL | use foo::{A, bar::B as A};
|
||||
| - ^^^^^^^^^^^^^^^^^ `A` reimported here
|
||||
| |
|
||||
| previous import of the type `A` here
|
||||
|
|
||||
= note: `A` must be defined only once in the type namespace of this module
|
||||
help: you can use `as` to change the binding name of the import
|
||||
|
|
||||
LL | use foo::{A, bar::B as OtherA};
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0252`.
|
||||
13
src/test/ui/issues/issue-45829/rename-with-path.rs
Normal file
13
src/test/ui/issues/issue-45829/rename-with-path.rs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <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.
|
||||
|
||||
use std::{collections::HashMap as A, sync::Arc as A};
|
||||
|
||||
fn main() {}
|
||||
17
src/test/ui/issues/issue-45829/rename-with-path.stderr
Normal file
17
src/test/ui/issues/issue-45829/rename-with-path.stderr
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
error[E0252]: the name `A` is defined multiple times
|
||||
--> $DIR/rename-with-path.rs:11:38
|
||||
|
|
||||
LL | use std::{collections::HashMap as A, sync::Arc as A};
|
||||
| ------------------------- ^^^^^^^^^^^^^^ `A` reimported here
|
||||
| |
|
||||
| previous import of the type `A` here
|
||||
|
|
||||
= note: `A` must be defined only once in the type namespace of this module
|
||||
help: you can use `as` to change the binding name of the import
|
||||
|
|
||||
LL | use std::{collections::HashMap as A, sync::Arc as OtherA};
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0252`.
|
||||
16
src/test/ui/issues/issue-45829/rename.rs
Normal file
16
src/test/ui/issues/issue-45829/rename.rs
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <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.
|
||||
|
||||
use core;
|
||||
use std as core;
|
||||
|
||||
fn main() {
|
||||
1 + 1;
|
||||
}
|
||||
17
src/test/ui/issues/issue-45829/rename.stderr
Normal file
17
src/test/ui/issues/issue-45829/rename.stderr
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
error[E0252]: the name `core` is defined multiple times
|
||||
--> $DIR/rename.rs:12:5
|
||||
|
|
||||
LL | use core;
|
||||
| ---- previous import of the module `core` here
|
||||
LL | use std as core;
|
||||
| ^^^^^^^^^^^ `core` reimported here
|
||||
|
|
||||
= note: `core` must be defined only once in the type namespace of this module
|
||||
help: you can use `as` to change the binding name of the import
|
||||
|
|
||||
LL | use std as other_core;
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0252`.
|
||||
|
|
@ -7,7 +7,7 @@ LL | mod bar {}
|
|||
| ^^^^^^^ `bar` redefined here
|
||||
|
|
||||
= note: `bar` must be defined only once in the type namespace of this module
|
||||
help: You can use `as` to change the binding name of the import
|
||||
help: you can use `as` to change the binding name of the import
|
||||
|
|
||||
LL | use baz::bar as other_bar;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ LL | extern crate core; //~ ERROR: the name `core` is defined multiple times
|
|||
| ^^^^^^^^^^^^^^^^^^ `core` reimported here
|
||||
|
|
||||
= note: `core` must be defined only once in the type namespace of this module
|
||||
help: You can use `as` to change the binding name of the import
|
||||
help: you can use `as` to change the binding name of the import
|
||||
|
|
||||
LL | extern crate core as other_core; //~ ERROR: the name `core` is defined multiple times
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ LL | extern crate std;
|
|||
| ^^^^^^^^^^^^^^^^^ `std` reimported here
|
||||
|
|
||||
= note: `std` must be defined only once in the type namespace of this module
|
||||
help: You can use `as` to change the binding name of the import
|
||||
help: you can use `as` to change the binding name of the import
|
||||
|
|
||||
LL | extern crate std as other_std;
|
||||
|
|
||||
|
|
|
|||
|
|
@ -5,10 +5,10 @@ LL | use std::slice as std; //~ ERROR the name `std` is defined multiple times
|
|||
| ^^^^^^^^^^^^^^^^^ `std` reimported here
|
||||
|
|
||||
= note: `std` must be defined only once in the type namespace of this module
|
||||
help: You can use `as` to change the binding name of the import
|
||||
help: you can use `as` to change the binding name of the import
|
||||
|
|
||||
LL | use std::slice as std as other_std; //~ ERROR the name `std` is defined multiple times
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
LL | use std::slice as other_std; //~ ERROR the name `std` is defined multiple times
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ LL | use std::mem::transmute;
|
|||
| ^^^^^^^^^^^^^^^^^^^ `transmute` reimported here
|
||||
|
|
||||
= note: `transmute` must be defined only once in the value namespace of this module
|
||||
help: You can use `as` to change the binding name of the import
|
||||
help: you can use `as` to change the binding name of the import
|
||||
|
|
||||
LL | use std::mem::transmute as other_transmute;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
|
|||
|
|
@ -5,10 +5,6 @@ LL | mod std {} //~ ERROR the name `std` is defined multiple times
|
|||
| ^^^^^^^ `std` redefined here
|
||||
|
|
||||
= note: `std` must be defined only once in the type namespace of this module
|
||||
help: You can use `as` to change the binding name of the import
|
||||
|
|
||||
LL | as other_std// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
||||
| ^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ LL | fn transmute() {}
|
|||
| ^^^^^^^^^^^^^^ `transmute` redefined here
|
||||
|
|
||||
= note: `transmute` must be defined only once in the value namespace of this module
|
||||
help: You can use `as` to change the binding name of the import
|
||||
help: you can use `as` to change the binding name of the import
|
||||
|
|
||||
LL | use std::mem::transmute as other_transmute;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ LL | struct Iter;
|
|||
| ^^^^^^^^^^^^ `Iter` redefined here
|
||||
|
|
||||
= note: `Iter` must be defined only once in the type namespace of this module
|
||||
help: You can use `as` to change the binding name of the import
|
||||
help: you can use `as` to change the binding name of the import
|
||||
|
|
||||
LL | use std::slice::Iter as OtherIter;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ LL | use core;
|
|||
| ^^^^ `core` reimported here
|
||||
|
|
||||
= note: `core` must be defined only once in the type namespace of this module
|
||||
help: You can use `as` to change the binding name of the import
|
||||
help: you can use `as` to change the binding name of the import
|
||||
|
|
||||
LL | use core as other_core;
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ LL | self
|
|||
| ^^^^ `bar` reimported here
|
||||
|
|
||||
= note: `bar` must be defined only once in the type namespace of this module
|
||||
help: You can use `as` to change the binding name of the import
|
||||
help: you can use `as` to change the binding name of the import
|
||||
|
|
||||
LL | self as other_bar
|
||||
|
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ LL | use std::mem; //~ ERROR the name `mem` is defined multiple times
|
|||
| ^^^^^^^^ `mem` reimported here
|
||||
|
|
||||
= note: `mem` must be defined only once in the type namespace of this module
|
||||
help: You can use `as` to change the binding name of the import
|
||||
help: you can use `as` to change the binding name of the import
|
||||
|
|
||||
LL | use std::mem as other_mem; //~ ERROR the name `mem` is defined multiple times
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ LL | pub use variant_namespacing::XE::{XStruct, XTuple, XUnit};
|
|||
| ^^^^^^^ `XStruct` reimported here
|
||||
|
|
||||
= note: `XStruct` must be defined only once in the type namespace of this module
|
||||
help: You can use `as` to change the binding name of the import
|
||||
help: you can use `as` to change the binding name of the import
|
||||
|
|
||||
LL | pub use variant_namespacing::XE::{XStruct as OtherXStruct, XTuple, XUnit};
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
@ -23,7 +23,7 @@ LL | pub use variant_namespacing::XE::{XStruct, XTuple, XUnit};
|
|||
| ^^^^^^ `XTuple` reimported here
|
||||
|
|
||||
= note: `XTuple` must be defined only once in the type namespace of this module
|
||||
help: You can use `as` to change the binding name of the import
|
||||
help: you can use `as` to change the binding name of the import
|
||||
|
|
||||
LL | pub use variant_namespacing::XE::{XStruct, XTuple as OtherXTuple, XUnit};
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
@ -38,7 +38,7 @@ LL | pub use variant_namespacing::XE::{XStruct, XTuple, XUnit};
|
|||
| ^^^^^ `XUnit` reimported here
|
||||
|
|
||||
= note: `XUnit` must be defined only once in the type namespace of this module
|
||||
help: You can use `as` to change the binding name of the import
|
||||
help: you can use `as` to change the binding name of the import
|
||||
|
|
||||
LL | pub use variant_namespacing::XE::{XStruct, XTuple, XUnit as OtherXUnit};
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
|
|
@ -53,7 +53,7 @@ LL | pub use E::{Struct, Tuple, Unit};
|
|||
| ^^^^^^ `Struct` reimported here
|
||||
|
|
||||
= note: `Struct` must be defined only once in the type namespace of this module
|
||||
help: You can use `as` to change the binding name of the import
|
||||
help: you can use `as` to change the binding name of the import
|
||||
|
|
||||
LL | pub use E::{Struct as OtherStruct, Tuple, Unit};
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
@ -68,7 +68,7 @@ LL | pub use E::{Struct, Tuple, Unit};
|
|||
| ^^^^^ `Tuple` reimported here
|
||||
|
|
||||
= note: `Tuple` must be defined only once in the type namespace of this module
|
||||
help: You can use `as` to change the binding name of the import
|
||||
help: you can use `as` to change the binding name of the import
|
||||
|
|
||||
LL | pub use E::{Struct, Tuple as OtherTuple, Unit};
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
|
|
@ -83,7 +83,7 @@ LL | pub use E::{Struct, Tuple, Unit};
|
|||
| ^^^^ `Unit` reimported here
|
||||
|
|
||||
= note: `Unit` must be defined only once in the type namespace of this module
|
||||
help: You can use `as` to change the binding name of the import
|
||||
help: you can use `as` to change the binding name of the import
|
||||
|
|
||||
LL | pub use E::{Struct, Tuple, Unit as OtherUnit};
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue