Add E0659 for ambiguous names

This commit is contained in:
Guillaume Gomez 2018-01-17 00:00:17 +01:00
parent da569fa9dd
commit f66e711f8b
7 changed files with 91 additions and 12 deletions

View file

@ -0,0 +1,26 @@
// 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 moon {
pub fn foo() {}
}
mod earth {
pub fn foo() {}
}
mod collider {
pub use moon::*;
pub use earth::*;
}
fn main() {
collider::foo(); //~ ERROR E0659
}

View file

@ -12,7 +12,7 @@ help: You can use `as` to change the binding name of the import
25 | use a::foo as Otherfoo; //~ ERROR the name `foo` is defined multiple times
| ^^^^^^^^^^^^^^^^^^
error: `foo` is ambiguous
error[E0659]: `foo` is ambiguous
--> $DIR/duplicate.rs:56:9
|
56 | use self::foo::bar; //~ ERROR `foo` is ambiguous
@ -30,7 +30,7 @@ note: `foo` could also refer to the name imported here
| ^^^^^^^^^^^
= note: consider adding an explicit import of `foo` to disambiguate
error: `foo` is ambiguous
error[E0659]: `foo` is ambiguous
--> $DIR/duplicate.rs:45:5
|
45 | f::foo(); //~ ERROR `foo` is ambiguous
@ -48,7 +48,7 @@ note: `foo` could also refer to the name imported here
| ^^^^
= note: consider adding an explicit import of `foo` to disambiguate
error: `foo` is ambiguous
error[E0659]: `foo` is ambiguous
--> $DIR/duplicate.rs:46:5
|
46 | g::foo(); //~ ERROR `foo` is ambiguous
@ -66,7 +66,7 @@ note: `foo` could also refer to the name imported here
| ^^^^
= note: consider adding an explicit import of `foo` to disambiguate
error: `foo` is ambiguous
error[E0659]: `foo` is ambiguous
--> $DIR/duplicate.rs:59:9
|
59 | foo::bar(); //~ ERROR `foo` is ambiguous

View file

@ -1,4 +1,4 @@
error: `bar` is ambiguous
error[E0659]: `bar` is ambiguous
--> $DIR/macro-paths.rs:25:5
|
25 | bar::m! { //~ ERROR ambiguous
@ -16,7 +16,7 @@ note: `bar` could also refer to the name imported here
| ^^^^^^
= note: macro-expanded items do not shadow when used in a macro invocation path
error: `baz` is ambiguous
error[E0659]: `baz` is ambiguous
--> $DIR/macro-paths.rs:35:5
|
35 | baz::m! { //~ ERROR ambiguous

View file

@ -15,7 +15,7 @@ note: `m` could also refer to the macro imported here
49 | use two_macros::m;
| ^^^^^^^^^^^^^
error: `m` is ambiguous
error[E0659]: `m` is ambiguous
--> $DIR/macros.rs:28:5
|
28 | m! { //~ ERROR ambiguous
@ -33,7 +33,7 @@ note: `m` could also refer to the name imported here
| ^^^^^^^^^^^^^
= note: macro-expanded macro imports do not shadow
error: `m` is ambiguous
error[E0659]: `m` is ambiguous
--> $DIR/macros.rs:41:9
|
41 | m! { //~ ERROR ambiguous

View file

@ -9,7 +9,7 @@ error: `panic` is already in scope
|
= note: macro-expanded `macro_rules!`s may not shadow existing macros (see RFC 1560)
error: `panic` is ambiguous
error[E0659]: `panic` is ambiguous
--> $DIR/shadow_builtin_macros.rs:27:14
|
27 | fn f() { panic!(); } //~ ERROR ambiguous
@ -23,7 +23,7 @@ note: `panic` could refer to the name imported here
= note: `panic` is also a builtin macro
= note: consider adding an explicit import of `panic` to disambiguate
error: `panic` is ambiguous
error[E0659]: `panic` is ambiguous
--> $DIR/shadow_builtin_macros.rs:32:14
|
32 | fn f() { panic!(); } //~ ERROR ambiguous
@ -37,7 +37,7 @@ note: `panic` could refer to the name imported here
= note: `panic` is also a builtin macro
= note: macro-expanded macro imports do not shadow
error: `n` is ambiguous
error[E0659]: `n` is ambiguous
--> $DIR/shadow_builtin_macros.rs:61:5
|
61 | n!(); //~ ERROR ambiguous