about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2018-01-17 00:00:17 +0100
committerGuillaume Gomez <guillaume1.gomez@gmail.com>2018-01-18 10:01:21 +0100
commitf66e711f8b7a62ff76bbf29df0dc21eac8000501 (patch)
tree7381ecd1a0448ff7a73b7ee52a7ca5204f294259 /src/test
parentda569fa9ddf8369a9809184d43c600dc06bd4b4d (diff)
downloadrust-f66e711f8b7a62ff76bbf29df0dc21eac8000501.tar.gz
rust-f66e711f8b7a62ff76bbf29df0dc21eac8000501.zip
Add E0659 for ambiguous names
Diffstat (limited to 'src/test')
-rw-r--r--src/test/compile-fail/E0659.rs26
-rw-r--r--src/test/ui/imports/duplicate.stderr8
-rw-r--r--src/test/ui/imports/macro-paths.stderr4
-rw-r--r--src/test/ui/imports/macros.stderr4
-rw-r--r--src/test/ui/imports/shadow_builtin_macros.stderr6
5 files changed, 37 insertions, 11 deletions
diff --git a/src/test/compile-fail/E0659.rs b/src/test/compile-fail/E0659.rs
new file mode 100644
index 00000000000..4bd452b0aac
--- /dev/null
+++ b/src/test/compile-fail/E0659.rs
@@ -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
+}
diff --git a/src/test/ui/imports/duplicate.stderr b/src/test/ui/imports/duplicate.stderr
index 30f2f517115..a74401314a1 100644
--- a/src/test/ui/imports/duplicate.stderr
+++ b/src/test/ui/imports/duplicate.stderr
@@ -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
diff --git a/src/test/ui/imports/macro-paths.stderr b/src/test/ui/imports/macro-paths.stderr
index 91b0b9756da..32d78666004 100644
--- a/src/test/ui/imports/macro-paths.stderr
+++ b/src/test/ui/imports/macro-paths.stderr
@@ -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
diff --git a/src/test/ui/imports/macros.stderr b/src/test/ui/imports/macros.stderr
index 0b67613eb14..75294f7bf12 100644
--- a/src/test/ui/imports/macros.stderr
+++ b/src/test/ui/imports/macros.stderr
@@ -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
diff --git a/src/test/ui/imports/shadow_builtin_macros.stderr b/src/test/ui/imports/shadow_builtin_macros.stderr
index 853ed98c30d..8f4325fa12c 100644
--- a/src/test/ui/imports/shadow_builtin_macros.stderr
+++ b/src/test/ui/imports/shadow_builtin_macros.stderr
@@ -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