about summary refs log tree commit diff
path: root/tests/ui/rust-2018/uniform-paths
diff options
context:
space:
mode:
authorAlbert Larsan <74931857+albertlarsan68@users.noreply.github.com>2023-01-05 09:13:28 +0100
committerAlbert Larsan <74931857+albertlarsan68@users.noreply.github.com>2023-01-11 09:32:08 +0000
commitcf2dff2b1e3fa55fa5415d524200070d0d7aacfe (patch)
tree40a88d9a46aaf3e8870676eb2538378b75a263eb /tests/ui/rust-2018/uniform-paths
parentca855e6e42787ecd062d81d53336fe6788ef51a9 (diff)
downloadrust-cf2dff2b1e3fa55fa5415d524200070d0d7aacfe.tar.gz
rust-cf2dff2b1e3fa55fa5415d524200070d0d7aacfe.zip
Move /src/test to /tests
Diffstat (limited to 'tests/ui/rust-2018/uniform-paths')
-rw-r--r--tests/ui/rust-2018/uniform-paths/ambiguity-macros-nested.rs21
-rw-r--r--tests/ui/rust-2018/uniform-paths/ambiguity-macros-nested.stderr25
-rw-r--r--tests/ui/rust-2018/uniform-paths/ambiguity-macros.rs19
-rw-r--r--tests/ui/rust-2018/uniform-paths/ambiguity-macros.stderr25
-rw-r--r--tests/ui/rust-2018/uniform-paths/ambiguity-nested.rs16
-rw-r--r--tests/ui/rust-2018/uniform-paths/ambiguity-nested.stderr21
-rw-r--r--tests/ui/rust-2018/uniform-paths/ambiguity.rs12
-rw-r--r--tests/ui/rust-2018/uniform-paths/ambiguity.stderr21
-rw-r--r--tests/ui/rust-2018/uniform-paths/auxiliary/cross-crate.rs5
-rw-r--r--tests/ui/rust-2018/uniform-paths/auxiliary/issue-55779-extern-trait.rs1
-rw-r--r--tests/ui/rust-2018/uniform-paths/auxiliary/issue-56596-2.rs1
-rw-r--r--tests/ui/rust-2018/uniform-paths/auxiliary/issue-56596.rs1
-rw-r--r--tests/ui/rust-2018/uniform-paths/auxiliary/issue-87932-a.rs3
-rw-r--r--tests/ui/rust-2018/uniform-paths/block-scoped-shadow-nested.rs20
-rw-r--r--tests/ui/rust-2018/uniform-paths/block-scoped-shadow-nested.stderr24
-rw-r--r--tests/ui/rust-2018/uniform-paths/block-scoped-shadow.rs21
-rw-r--r--tests/ui/rust-2018/uniform-paths/block-scoped-shadow.stderr60
-rw-r--r--tests/ui/rust-2018/uniform-paths/cross-crate.rs12
-rw-r--r--tests/ui/rust-2018/uniform-paths/cross-crate.stderr38
-rw-r--r--tests/ui/rust-2018/uniform-paths/deadlock.rs8
-rw-r--r--tests/ui/rust-2018/uniform-paths/deadlock.stderr24
-rw-r--r--tests/ui/rust-2018/uniform-paths/fn-local-enum.rs13
-rw-r--r--tests/ui/rust-2018/uniform-paths/from-decl-macro.rs12
-rw-r--r--tests/ui/rust-2018/uniform-paths/issue-54253.rs17
-rw-r--r--tests/ui/rust-2018/uniform-paths/issue-54253.stderr9
-rw-r--r--tests/ui/rust-2018/uniform-paths/issue-55779.rs29
-rw-r--r--tests/ui/rust-2018/uniform-paths/issue-56596-2.rs11
-rw-r--r--tests/ui/rust-2018/uniform-paths/issue-56596.rs12
-rw-r--r--tests/ui/rust-2018/uniform-paths/issue-56596.stderr19
-rw-r--r--tests/ui/rust-2018/uniform-paths/issue-87932.rs15
-rw-r--r--tests/ui/rust-2018/uniform-paths/issue-87932.stderr18
-rw-r--r--tests/ui/rust-2018/uniform-paths/macro-rules.rs43
-rw-r--r--tests/ui/rust-2018/uniform-paths/macro-rules.stderr35
-rw-r--r--tests/ui/rust-2018/uniform-paths/prelude-fail-2.rs21
-rw-r--r--tests/ui/rust-2018/uniform-paths/prelude-fail-2.stderr68
-rw-r--r--tests/ui/rust-2018/uniform-paths/prelude-fail.rs6
-rw-r--r--tests/ui/rust-2018/uniform-paths/prelude-fail.stderr9
-rw-r--r--tests/ui/rust-2018/uniform-paths/prelude.rs22
-rw-r--r--tests/ui/rust-2018/uniform-paths/redundant.rs20
39 files changed, 757 insertions, 0 deletions
diff --git a/tests/ui/rust-2018/uniform-paths/ambiguity-macros-nested.rs b/tests/ui/rust-2018/uniform-paths/ambiguity-macros-nested.rs
new file mode 100644
index 00000000000..678b4774dba
--- /dev/null
+++ b/tests/ui/rust-2018/uniform-paths/ambiguity-macros-nested.rs
@@ -0,0 +1,21 @@
+// edition:2018
+
+// This test is similar to `ambiguity-macros.rs`, but nested in a module.
+
+#![allow(non_camel_case_types)]
+
+mod foo {
+    pub use std::io;
+    //~^ ERROR `std` is ambiguous
+
+    macro_rules! m {
+        () => {
+            mod std {
+                pub struct io;
+            }
+        }
+    }
+    m!();
+}
+
+fn main() {}
diff --git a/tests/ui/rust-2018/uniform-paths/ambiguity-macros-nested.stderr b/tests/ui/rust-2018/uniform-paths/ambiguity-macros-nested.stderr
new file mode 100644
index 00000000000..7e008d46574
--- /dev/null
+++ b/tests/ui/rust-2018/uniform-paths/ambiguity-macros-nested.stderr
@@ -0,0 +1,25 @@
+error[E0659]: `std` is ambiguous
+  --> $DIR/ambiguity-macros-nested.rs:8:13
+   |
+LL |     pub use std::io;
+   |             ^^^ ambiguous name
+   |
+   = note: ambiguous because of multiple potential import sources
+   = note: `std` could refer to a built-in crate
+   = help: use `::std` to refer to this crate unambiguously
+note: `std` could also refer to the module defined here
+  --> $DIR/ambiguity-macros-nested.rs:13:13
+   |
+LL | /             mod std {
+LL | |                 pub struct io;
+LL | |             }
+   | |_____________^
+...
+LL |       m!();
+   |       ---- in this macro invocation
+   = help: use `self::std` to refer to this module unambiguously
+   = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0659`.
diff --git a/tests/ui/rust-2018/uniform-paths/ambiguity-macros.rs b/tests/ui/rust-2018/uniform-paths/ambiguity-macros.rs
new file mode 100644
index 00000000000..56ea726d73e
--- /dev/null
+++ b/tests/ui/rust-2018/uniform-paths/ambiguity-macros.rs
@@ -0,0 +1,19 @@
+// edition:2018
+
+// This test is similar to `ambiguity.rs`, but with macros defining local items.
+
+#![allow(non_camel_case_types)]
+
+use std::io;
+//~^ ERROR `std` is ambiguous
+
+macro_rules! m {
+    () => {
+        mod std {
+            pub struct io;
+        }
+    }
+}
+m!();
+
+fn main() {}
diff --git a/tests/ui/rust-2018/uniform-paths/ambiguity-macros.stderr b/tests/ui/rust-2018/uniform-paths/ambiguity-macros.stderr
new file mode 100644
index 00000000000..771d2c10c1d
--- /dev/null
+++ b/tests/ui/rust-2018/uniform-paths/ambiguity-macros.stderr
@@ -0,0 +1,25 @@
+error[E0659]: `std` is ambiguous
+  --> $DIR/ambiguity-macros.rs:7:5
+   |
+LL | use std::io;
+   |     ^^^ ambiguous name
+   |
+   = note: ambiguous because of multiple potential import sources
+   = note: `std` could refer to a built-in crate
+   = help: use `::std` to refer to this crate unambiguously
+note: `std` could also refer to the module defined here
+  --> $DIR/ambiguity-macros.rs:12:9
+   |
+LL | /         mod std {
+LL | |             pub struct io;
+LL | |         }
+   | |_________^
+...
+LL |   m!();
+   |   ---- in this macro invocation
+   = help: use `crate::std` to refer to this module unambiguously
+   = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0659`.
diff --git a/tests/ui/rust-2018/uniform-paths/ambiguity-nested.rs b/tests/ui/rust-2018/uniform-paths/ambiguity-nested.rs
new file mode 100644
index 00000000000..50c8fc8229c
--- /dev/null
+++ b/tests/ui/rust-2018/uniform-paths/ambiguity-nested.rs
@@ -0,0 +1,16 @@
+// edition:2018
+
+// This test is similar to `ambiguity.rs`, but nested in a module.
+
+#![allow(non_camel_case_types)]
+
+mod foo {
+    pub use std::io;
+    //~^ ERROR `std` is ambiguous
+
+    mod std {
+        pub struct io;
+    }
+}
+
+fn main() {}
diff --git a/tests/ui/rust-2018/uniform-paths/ambiguity-nested.stderr b/tests/ui/rust-2018/uniform-paths/ambiguity-nested.stderr
new file mode 100644
index 00000000000..defb16f7970
--- /dev/null
+++ b/tests/ui/rust-2018/uniform-paths/ambiguity-nested.stderr
@@ -0,0 +1,21 @@
+error[E0659]: `std` is ambiguous
+  --> $DIR/ambiguity-nested.rs:8:13
+   |
+LL |     pub use std::io;
+   |             ^^^ ambiguous name
+   |
+   = note: ambiguous because of multiple potential import sources
+   = note: `std` could refer to a built-in crate
+   = help: use `::std` to refer to this crate unambiguously
+note: `std` could also refer to the module defined here
+  --> $DIR/ambiguity-nested.rs:11:5
+   |
+LL | /     mod std {
+LL | |         pub struct io;
+LL | |     }
+   | |_____^
+   = help: use `self::std` to refer to this module unambiguously
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0659`.
diff --git a/tests/ui/rust-2018/uniform-paths/ambiguity.rs b/tests/ui/rust-2018/uniform-paths/ambiguity.rs
new file mode 100644
index 00000000000..60f77a1c663
--- /dev/null
+++ b/tests/ui/rust-2018/uniform-paths/ambiguity.rs
@@ -0,0 +1,12 @@
+// edition:2018
+
+#![allow(non_camel_case_types)]
+
+use std::io;
+//~^ ERROR `std` is ambiguous
+
+mod std {
+    pub struct io;
+}
+
+fn main() {}
diff --git a/tests/ui/rust-2018/uniform-paths/ambiguity.stderr b/tests/ui/rust-2018/uniform-paths/ambiguity.stderr
new file mode 100644
index 00000000000..2d735c7e3fd
--- /dev/null
+++ b/tests/ui/rust-2018/uniform-paths/ambiguity.stderr
@@ -0,0 +1,21 @@
+error[E0659]: `std` is ambiguous
+  --> $DIR/ambiguity.rs:5:5
+   |
+LL | use std::io;
+   |     ^^^ ambiguous name
+   |
+   = note: ambiguous because of multiple potential import sources
+   = note: `std` could refer to a built-in crate
+   = help: use `::std` to refer to this crate unambiguously
+note: `std` could also refer to the module defined here
+  --> $DIR/ambiguity.rs:8:1
+   |
+LL | / mod std {
+LL | |     pub struct io;
+LL | | }
+   | |_^
+   = help: use `crate::std` to refer to this module unambiguously
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0659`.
diff --git a/tests/ui/rust-2018/uniform-paths/auxiliary/cross-crate.rs b/tests/ui/rust-2018/uniform-paths/auxiliary/cross-crate.rs
new file mode 100644
index 00000000000..4aa5d187000
--- /dev/null
+++ b/tests/ui/rust-2018/uniform-paths/auxiliary/cross-crate.rs
@@ -0,0 +1,5 @@
+// edition:2018
+
+pub use ignore as built_in_attr;
+pub use u8 as built_in_type;
+pub use rustfmt as tool_mod;
diff --git a/tests/ui/rust-2018/uniform-paths/auxiliary/issue-55779-extern-trait.rs b/tests/ui/rust-2018/uniform-paths/auxiliary/issue-55779-extern-trait.rs
new file mode 100644
index 00000000000..1ce9841c1a8
--- /dev/null
+++ b/tests/ui/rust-2018/uniform-paths/auxiliary/issue-55779-extern-trait.rs
@@ -0,0 +1 @@
+pub trait Trait { fn no_op(&self); }
diff --git a/tests/ui/rust-2018/uniform-paths/auxiliary/issue-56596-2.rs b/tests/ui/rust-2018/uniform-paths/auxiliary/issue-56596-2.rs
new file mode 100644
index 00000000000..db723075f93
--- /dev/null
+++ b/tests/ui/rust-2018/uniform-paths/auxiliary/issue-56596-2.rs
@@ -0,0 +1 @@
+pub extern crate core;
diff --git a/tests/ui/rust-2018/uniform-paths/auxiliary/issue-56596.rs b/tests/ui/rust-2018/uniform-paths/auxiliary/issue-56596.rs
new file mode 100644
index 00000000000..bc010a3dd2b
--- /dev/null
+++ b/tests/ui/rust-2018/uniform-paths/auxiliary/issue-56596.rs
@@ -0,0 +1 @@
+// Nothing here
diff --git a/tests/ui/rust-2018/uniform-paths/auxiliary/issue-87932-a.rs b/tests/ui/rust-2018/uniform-paths/auxiliary/issue-87932-a.rs
new file mode 100644
index 00000000000..8fd2d77be39
--- /dev/null
+++ b/tests/ui/rust-2018/uniform-paths/auxiliary/issue-87932-a.rs
@@ -0,0 +1,3 @@
+pub trait Deserialize {
+    fn deserialize();
+}
diff --git a/tests/ui/rust-2018/uniform-paths/block-scoped-shadow-nested.rs b/tests/ui/rust-2018/uniform-paths/block-scoped-shadow-nested.rs
new file mode 100644
index 00000000000..3f5897901a0
--- /dev/null
+++ b/tests/ui/rust-2018/uniform-paths/block-scoped-shadow-nested.rs
@@ -0,0 +1,20 @@
+// edition:2018
+
+mod my {
+    pub mod sub {
+        pub fn bar() {}
+    }
+}
+
+mod sub {
+    pub fn bar() {}
+}
+
+fn foo() {
+    use my::sub;
+    {
+        use sub::bar; //~ ERROR `sub` is ambiguous
+    }
+}
+
+fn main() {}
diff --git a/tests/ui/rust-2018/uniform-paths/block-scoped-shadow-nested.stderr b/tests/ui/rust-2018/uniform-paths/block-scoped-shadow-nested.stderr
new file mode 100644
index 00000000000..3d45a814029
--- /dev/null
+++ b/tests/ui/rust-2018/uniform-paths/block-scoped-shadow-nested.stderr
@@ -0,0 +1,24 @@
+error[E0659]: `sub` is ambiguous
+  --> $DIR/block-scoped-shadow-nested.rs:16:13
+   |
+LL |         use sub::bar;
+   |             ^^^ ambiguous name
+   |
+   = note: ambiguous because of multiple potential import sources
+note: `sub` could refer to the module imported here
+  --> $DIR/block-scoped-shadow-nested.rs:14:9
+   |
+LL |     use my::sub;
+   |         ^^^^^^^
+note: `sub` could also refer to the module defined here
+  --> $DIR/block-scoped-shadow-nested.rs:9:1
+   |
+LL | / mod sub {
+LL | |     pub fn bar() {}
+LL | | }
+   | |_^
+   = help: use `crate::sub` to refer to this module unambiguously
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0659`.
diff --git a/tests/ui/rust-2018/uniform-paths/block-scoped-shadow.rs b/tests/ui/rust-2018/uniform-paths/block-scoped-shadow.rs
new file mode 100644
index 00000000000..828ee4fe474
--- /dev/null
+++ b/tests/ui/rust-2018/uniform-paths/block-scoped-shadow.rs
@@ -0,0 +1,21 @@
+// edition:2018
+
+#![allow(non_camel_case_types)]
+
+enum Foo {}
+
+struct std;
+
+fn main() {
+    enum Foo { A, B }
+    use Foo::*;
+    //~^ ERROR `Foo` is ambiguous
+
+    let _ = (A, B);
+
+    fn std() {}
+    enum std {}
+    use std as foo;
+    //~^ ERROR `std` is ambiguous
+    //~| ERROR `std` is ambiguous
+}
diff --git a/tests/ui/rust-2018/uniform-paths/block-scoped-shadow.stderr b/tests/ui/rust-2018/uniform-paths/block-scoped-shadow.stderr
new file mode 100644
index 00000000000..b068312cedd
--- /dev/null
+++ b/tests/ui/rust-2018/uniform-paths/block-scoped-shadow.stderr
@@ -0,0 +1,60 @@
+error[E0659]: `Foo` is ambiguous
+  --> $DIR/block-scoped-shadow.rs:11:9
+   |
+LL |     use Foo::*;
+   |         ^^^ ambiguous name
+   |
+   = note: ambiguous because of multiple potential import sources
+note: `Foo` could refer to the enum defined here
+  --> $DIR/block-scoped-shadow.rs:10:5
+   |
+LL |     enum Foo { A, B }
+   |     ^^^^^^^^^^^^^^^^^
+note: `Foo` could also refer to the enum defined here
+  --> $DIR/block-scoped-shadow.rs:5:1
+   |
+LL | enum Foo {}
+   | ^^^^^^^^^^^
+   = help: use `crate::Foo` to refer to this enum unambiguously
+
+error[E0659]: `std` is ambiguous
+  --> $DIR/block-scoped-shadow.rs:18:9
+   |
+LL |     use std as foo;
+   |         ^^^ ambiguous name
+   |
+   = note: ambiguous because of multiple potential import sources
+note: `std` could refer to the enum defined here
+  --> $DIR/block-scoped-shadow.rs:17:5
+   |
+LL |     enum std {}
+   |     ^^^^^^^^^^^
+note: `std` could also refer to the struct defined here
+  --> $DIR/block-scoped-shadow.rs:7:1
+   |
+LL | struct std;
+   | ^^^^^^^^^^^
+   = help: use `crate::std` to refer to this struct unambiguously
+
+error[E0659]: `std` is ambiguous
+  --> $DIR/block-scoped-shadow.rs:18:9
+   |
+LL |     use std as foo;
+   |         ^^^ ambiguous name
+   |
+   = note: ambiguous because of multiple potential import sources
+note: `std` could refer to the function defined here
+  --> $DIR/block-scoped-shadow.rs:16:5
+   |
+LL |     fn std() {}
+   |     ^^^^^^^^^^^
+note: `std` could also refer to the unit struct defined here
+  --> $DIR/block-scoped-shadow.rs:7:1
+   |
+LL | struct std;
+   | ^^^^^^^^^^^
+   = help: use `crate::std` to refer to this unit struct unambiguously
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0659`.
diff --git a/tests/ui/rust-2018/uniform-paths/cross-crate.rs b/tests/ui/rust-2018/uniform-paths/cross-crate.rs
new file mode 100644
index 00000000000..0ca7fa37a30
--- /dev/null
+++ b/tests/ui/rust-2018/uniform-paths/cross-crate.rs
@@ -0,0 +1,12 @@
+// edition:2018
+// aux-build:cross-crate.rs
+
+extern crate cross_crate;
+use cross_crate::*;
+
+#[built_in_attr] //~ ERROR cannot use a built-in attribute through an import
+#[tool_mod::skip] //~ ERROR cannot use a tool module through an import
+                  //~| ERROR cannot use a tool module through an import
+fn main() {
+    let _: built_in_type; // OK
+}
diff --git a/tests/ui/rust-2018/uniform-paths/cross-crate.stderr b/tests/ui/rust-2018/uniform-paths/cross-crate.stderr
new file mode 100644
index 00000000000..45f77a0c9fe
--- /dev/null
+++ b/tests/ui/rust-2018/uniform-paths/cross-crate.stderr
@@ -0,0 +1,38 @@
+error: cannot use a built-in attribute through an import
+  --> $DIR/cross-crate.rs:7:3
+   |
+LL | #[built_in_attr]
+   |   ^^^^^^^^^^^^^
+   |
+note: the built-in attribute imported here
+  --> $DIR/cross-crate.rs:5:5
+   |
+LL | use cross_crate::*;
+   |     ^^^^^^^^^^^^^^
+
+error: cannot use a tool module through an import
+  --> $DIR/cross-crate.rs:8:3
+   |
+LL | #[tool_mod::skip]
+   |   ^^^^^^^^
+   |
+note: the tool module imported here
+  --> $DIR/cross-crate.rs:5:5
+   |
+LL | use cross_crate::*;
+   |     ^^^^^^^^^^^^^^
+
+error: cannot use a tool module through an import
+  --> $DIR/cross-crate.rs:8:3
+   |
+LL | #[tool_mod::skip]
+   |   ^^^^^^^^
+   |
+note: the tool module imported here
+  --> $DIR/cross-crate.rs:5:5
+   |
+LL | use cross_crate::*;
+   |     ^^^^^^^^^^^^^^
+
+error: aborting due to 3 previous errors
+
diff --git a/tests/ui/rust-2018/uniform-paths/deadlock.rs b/tests/ui/rust-2018/uniform-paths/deadlock.rs
new file mode 100644
index 00000000000..2427bde6d18
--- /dev/null
+++ b/tests/ui/rust-2018/uniform-paths/deadlock.rs
@@ -0,0 +1,8 @@
+// edition:2018
+// compile-flags:--extern foo --extern bar
+
+use bar::foo; //~ ERROR can't find crate for `bar`
+use foo::bar; //~ ERROR can't find crate for `foo`
+//~^^ ERROR unresolved imports `bar::foo`, `foo::bar`
+
+fn main() {}
diff --git a/tests/ui/rust-2018/uniform-paths/deadlock.stderr b/tests/ui/rust-2018/uniform-paths/deadlock.stderr
new file mode 100644
index 00000000000..8b9863948bd
--- /dev/null
+++ b/tests/ui/rust-2018/uniform-paths/deadlock.stderr
@@ -0,0 +1,24 @@
+error[E0463]: can't find crate for `bar`
+  --> $DIR/deadlock.rs:4:5
+   |
+LL | use bar::foo;
+   |     ^^^ can't find crate
+
+error[E0463]: can't find crate for `foo`
+  --> $DIR/deadlock.rs:5:5
+   |
+LL | use foo::bar;
+   |     ^^^ can't find crate
+
+error[E0432]: unresolved imports `bar::foo`, `foo::bar`
+  --> $DIR/deadlock.rs:4:5
+   |
+LL | use bar::foo;
+   |     ^^^^^^^^
+LL | use foo::bar;
+   |     ^^^^^^^^
+
+error: aborting due to 3 previous errors
+
+Some errors have detailed explanations: E0432, E0463.
+For more information about an error, try `rustc --explain E0432`.
diff --git a/tests/ui/rust-2018/uniform-paths/fn-local-enum.rs b/tests/ui/rust-2018/uniform-paths/fn-local-enum.rs
new file mode 100644
index 00000000000..c6525869b02
--- /dev/null
+++ b/tests/ui/rust-2018/uniform-paths/fn-local-enum.rs
@@ -0,0 +1,13 @@
+// build-pass (FIXME(62277): could be check-pass?)
+// edition:2018
+
+fn main() {
+    enum E { A, B, C }
+
+    use E::*;
+    match A {
+        A => {}
+        B => {}
+        C => {}
+    }
+}
diff --git a/tests/ui/rust-2018/uniform-paths/from-decl-macro.rs b/tests/ui/rust-2018/uniform-paths/from-decl-macro.rs
new file mode 100644
index 00000000000..9af520a0769
--- /dev/null
+++ b/tests/ui/rust-2018/uniform-paths/from-decl-macro.rs
@@ -0,0 +1,12 @@
+// build-pass (FIXME(62277): could be check-pass?)
+// edition:2018
+
+#![feature(decl_macro)]
+
+macro check() {
+    ::std::vec::Vec::<u8>::new()
+}
+
+fn main() {
+    check!();
+}
diff --git a/tests/ui/rust-2018/uniform-paths/issue-54253.rs b/tests/ui/rust-2018/uniform-paths/issue-54253.rs
new file mode 100644
index 00000000000..7db469945e0
--- /dev/null
+++ b/tests/ui/rust-2018/uniform-paths/issue-54253.rs
@@ -0,0 +1,17 @@
+// edition:2018
+
+// Dummy import that previously introduced uniform path canaries.
+use std;
+
+// fn version() -> &'static str {""}
+
+mod foo {
+    // Error wasn't reported, despite `version` being commented out above.
+    use crate::version; //~ ERROR unresolved import `crate::version`
+
+    fn bar() {
+        version();
+    }
+}
+
+fn main() {}
diff --git a/tests/ui/rust-2018/uniform-paths/issue-54253.stderr b/tests/ui/rust-2018/uniform-paths/issue-54253.stderr
new file mode 100644
index 00000000000..adde6359035
--- /dev/null
+++ b/tests/ui/rust-2018/uniform-paths/issue-54253.stderr
@@ -0,0 +1,9 @@
+error[E0432]: unresolved import `crate::version`
+  --> $DIR/issue-54253.rs:10:9
+   |
+LL |     use crate::version;
+   |         ^^^^^^^^^^^^^^ no `version` in the root
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0432`.
diff --git a/tests/ui/rust-2018/uniform-paths/issue-55779.rs b/tests/ui/rust-2018/uniform-paths/issue-55779.rs
new file mode 100644
index 00000000000..0af17a89b17
--- /dev/null
+++ b/tests/ui/rust-2018/uniform-paths/issue-55779.rs
@@ -0,0 +1,29 @@
+// run-pass
+// edition:2018
+// aux-crate:issue_55779_extern_trait=issue-55779-extern-trait.rs
+
+use issue_55779_extern_trait::Trait;
+
+struct Local;
+struct Helper;
+
+impl Trait for Local {
+    fn no_op(&self)
+    {
+        // (Unused) extern crate declaration necessary to reproduce bug
+        extern crate issue_55779_extern_trait;
+
+        // This one works
+        // impl Trait for Helper { fn no_op(&self) { } }
+
+        // This one infinite-loops
+        const _IMPL_SERIALIZE_FOR_HELPER: () = {
+            // (extern crate can also appear here to reproduce bug,
+            // as in originating example from serde)
+            impl Trait for Helper { fn no_op(&self) { } }
+        };
+
+    }
+}
+
+fn main() { }
diff --git a/tests/ui/rust-2018/uniform-paths/issue-56596-2.rs b/tests/ui/rust-2018/uniform-paths/issue-56596-2.rs
new file mode 100644
index 00000000000..9ea7e496d2b
--- /dev/null
+++ b/tests/ui/rust-2018/uniform-paths/issue-56596-2.rs
@@ -0,0 +1,11 @@
+// check-pass
+// edition:2018
+// compile-flags: --extern issue_56596_2
+// aux-build:issue-56596-2.rs
+
+mod m {
+    use core::any;
+    pub use issue_56596_2::*;
+}
+
+fn main() {}
diff --git a/tests/ui/rust-2018/uniform-paths/issue-56596.rs b/tests/ui/rust-2018/uniform-paths/issue-56596.rs
new file mode 100644
index 00000000000..ec5bb656ad4
--- /dev/null
+++ b/tests/ui/rust-2018/uniform-paths/issue-56596.rs
@@ -0,0 +1,12 @@
+// edition:2018
+// compile-flags: --extern issue_56596
+// aux-build:issue-56596.rs
+
+mod m {
+    pub mod issue_56596 {}
+}
+
+use m::*;
+use issue_56596; //~ ERROR `issue_56596` is ambiguous
+
+fn main() {}
diff --git a/tests/ui/rust-2018/uniform-paths/issue-56596.stderr b/tests/ui/rust-2018/uniform-paths/issue-56596.stderr
new file mode 100644
index 00000000000..8b8ab26dce2
--- /dev/null
+++ b/tests/ui/rust-2018/uniform-paths/issue-56596.stderr
@@ -0,0 +1,19 @@
+error[E0659]: `issue_56596` is ambiguous
+  --> $DIR/issue-56596.rs:10:5
+   |
+LL | use issue_56596;
+   |     ^^^^^^^^^^^ ambiguous name
+   |
+   = note: ambiguous because of multiple potential import sources
+   = note: `issue_56596` could refer to a crate passed with `--extern`
+   = help: use `::issue_56596` to refer to this crate unambiguously
+note: `issue_56596` could also refer to the module imported here
+  --> $DIR/issue-56596.rs:9:5
+   |
+LL | use m::*;
+   |     ^^^^
+   = help: use `crate::issue_56596` to refer to this module unambiguously
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0659`.
diff --git a/tests/ui/rust-2018/uniform-paths/issue-87932.rs b/tests/ui/rust-2018/uniform-paths/issue-87932.rs
new file mode 100644
index 00000000000..70a641d8a47
--- /dev/null
+++ b/tests/ui/rust-2018/uniform-paths/issue-87932.rs
@@ -0,0 +1,15 @@
+// edition:2018
+// aux-crate:issue_87932_a=issue-87932-a.rs
+
+pub struct A {}
+
+impl issue_87932_a::Deserialize for A {
+    fn deserialize() {
+        extern crate issue_87932_a as _a;
+    }
+}
+
+fn main() {
+    A::deserialize();
+    //~^ ERROR no function or associated item named `deserialize` found for struct `A`
+}
diff --git a/tests/ui/rust-2018/uniform-paths/issue-87932.stderr b/tests/ui/rust-2018/uniform-paths/issue-87932.stderr
new file mode 100644
index 00000000000..b52720ae3d9
--- /dev/null
+++ b/tests/ui/rust-2018/uniform-paths/issue-87932.stderr
@@ -0,0 +1,18 @@
+error[E0599]: no function or associated item named `deserialize` found for struct `A` in the current scope
+  --> $DIR/issue-87932.rs:13:8
+   |
+LL | pub struct A {}
+   | ------------ function or associated item `deserialize` not found for this struct
+...
+LL |     A::deserialize();
+   |        ^^^^^^^^^^^ function or associated item not found in `A`
+   |
+   = help: items from traits can only be used if the trait is in scope
+help: the following trait is implemented but not in scope; perhaps add a `use` for it:
+   |
+LL | use <crate::A as issue_87932_a::Deserialize>::deserialize::_a::Deserialize;
+   |
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0599`.
diff --git a/tests/ui/rust-2018/uniform-paths/macro-rules.rs b/tests/ui/rust-2018/uniform-paths/macro-rules.rs
new file mode 100644
index 00000000000..2d9a6a9a924
--- /dev/null
+++ b/tests/ui/rust-2018/uniform-paths/macro-rules.rs
@@ -0,0 +1,43 @@
+// edition:2018
+
+#![feature(decl_macro)]
+
+mod m1 {
+    // Non-exported legacy macros are treated as `pub(crate)`.
+    macro_rules! legacy_macro { () => () }
+
+    use legacy_macro as _; // OK
+    pub(crate) use legacy_macro as _; // OK
+    pub use legacy_macro as _; //~ ERROR `legacy_macro` is only public within the crate, and cannot be re-exported outside
+}
+
+mod m2 {
+    macro_rules! legacy_macro { () => () }
+
+    #[allow(non_camel_case_types)]
+    type legacy_macro = u8;
+
+    // Legacy macro imports don't prevent names from other namespaces from being imported.
+    use legacy_macro as _; // OK
+}
+
+mod m3 {
+    macro legacy_macro() {}
+
+    fn f() {
+        macro_rules! legacy_macro { () => () }
+
+        // Legacy macro imports create ambiguities with other names in the same namespace.
+        use legacy_macro as _; //~ ERROR `legacy_macro` is ambiguous
+    }
+}
+
+mod exported {
+    // Exported legacy macros are treated as `pub`.
+    #[macro_export]
+    macro_rules! legacy_macro { () => () }
+
+    pub use legacy_macro as _; // OK
+}
+
+fn main() {}
diff --git a/tests/ui/rust-2018/uniform-paths/macro-rules.stderr b/tests/ui/rust-2018/uniform-paths/macro-rules.stderr
new file mode 100644
index 00000000000..9f8c928c32c
--- /dev/null
+++ b/tests/ui/rust-2018/uniform-paths/macro-rules.stderr
@@ -0,0 +1,35 @@
+error[E0364]: `legacy_macro` is only public within the crate, and cannot be re-exported outside
+  --> $DIR/macro-rules.rs:11:13
+   |
+LL |     pub use legacy_macro as _;
+   |             ^^^^^^^^^^^^^^^^^
+   |
+help: consider adding a `#[macro_export]` to the macro in the imported module
+  --> $DIR/macro-rules.rs:7:5
+   |
+LL |     macro_rules! legacy_macro { () => () }
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0659]: `legacy_macro` is ambiguous
+  --> $DIR/macro-rules.rs:31:13
+   |
+LL |         use legacy_macro as _;
+   |             ^^^^^^^^^^^^ ambiguous name
+   |
+   = note: ambiguous because of multiple potential import sources
+note: `legacy_macro` could refer to the macro defined here
+  --> $DIR/macro-rules.rs:28:9
+   |
+LL |         macro_rules! legacy_macro { () => () }
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+note: `legacy_macro` could also refer to the macro defined here
+  --> $DIR/macro-rules.rs:25:5
+   |
+LL |     macro legacy_macro() {}
+   |     ^^^^^^^^^^^^^^^^^^^^^^^
+   = help: use `self::legacy_macro` to refer to this macro unambiguously
+
+error: aborting due to 2 previous errors
+
+Some errors have detailed explanations: E0364, E0659.
+For more information about an error, try `rustc --explain E0364`.
diff --git a/tests/ui/rust-2018/uniform-paths/prelude-fail-2.rs b/tests/ui/rust-2018/uniform-paths/prelude-fail-2.rs
new file mode 100644
index 00000000000..44da71de085
--- /dev/null
+++ b/tests/ui/rust-2018/uniform-paths/prelude-fail-2.rs
@@ -0,0 +1,21 @@
+// edition:2018
+
+// Built-in attribute
+use inline as imported_inline;
+mod builtin {
+    pub use inline as imported_inline;
+}
+
+// Tool module
+use rustfmt as imported_rustfmt;
+mod tool_mod {
+    pub use rustfmt as imported_rustfmt;
+}
+
+#[imported_inline] //~ ERROR cannot use a built-in attribute through an import
+#[builtin::imported_inline] //~ ERROR cannot use a built-in attribute through an import
+#[imported_rustfmt::skip] //~ ERROR cannot use a tool module through an import
+                          //~| ERROR cannot use a tool module through an import
+#[tool_mod::imported_rustfmt::skip] //~ ERROR cannot use a tool module through an import
+                                    //~| ERROR cannot use a tool module through an import
+fn main() {}
diff --git a/tests/ui/rust-2018/uniform-paths/prelude-fail-2.stderr b/tests/ui/rust-2018/uniform-paths/prelude-fail-2.stderr
new file mode 100644
index 00000000000..908bb498586
--- /dev/null
+++ b/tests/ui/rust-2018/uniform-paths/prelude-fail-2.stderr
@@ -0,0 +1,68 @@
+error: cannot use a built-in attribute through an import
+  --> $DIR/prelude-fail-2.rs:15:3
+   |
+LL | #[imported_inline]
+   |   ^^^^^^^^^^^^^^^
+   |
+note: the built-in attribute imported here
+  --> $DIR/prelude-fail-2.rs:4:5
+   |
+LL | use inline as imported_inline;
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: cannot use a built-in attribute through an import
+  --> $DIR/prelude-fail-2.rs:16:3
+   |
+LL | #[builtin::imported_inline]
+   |   ^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: cannot use a tool module through an import
+  --> $DIR/prelude-fail-2.rs:17:3
+   |
+LL | #[imported_rustfmt::skip]
+   |   ^^^^^^^^^^^^^^^^
+   |
+note: the tool module imported here
+  --> $DIR/prelude-fail-2.rs:10:5
+   |
+LL | use rustfmt as imported_rustfmt;
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: cannot use a tool module through an import
+  --> $DIR/prelude-fail-2.rs:19:13
+   |
+LL | #[tool_mod::imported_rustfmt::skip]
+   |             ^^^^^^^^^^^^^^^^
+   |
+note: the tool module imported here
+  --> $DIR/prelude-fail-2.rs:12:13
+   |
+LL |     pub use rustfmt as imported_rustfmt;
+   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: cannot use a tool module through an import
+  --> $DIR/prelude-fail-2.rs:17:3
+   |
+LL | #[imported_rustfmt::skip]
+   |   ^^^^^^^^^^^^^^^^
+   |
+note: the tool module imported here
+  --> $DIR/prelude-fail-2.rs:10:5
+   |
+LL | use rustfmt as imported_rustfmt;
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: cannot use a tool module through an import
+  --> $DIR/prelude-fail-2.rs:19:13
+   |
+LL | #[tool_mod::imported_rustfmt::skip]
+   |             ^^^^^^^^^^^^^^^^
+   |
+note: the tool module imported here
+  --> $DIR/prelude-fail-2.rs:12:13
+   |
+LL |     pub use rustfmt as imported_rustfmt;
+   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 6 previous errors
+
diff --git a/tests/ui/rust-2018/uniform-paths/prelude-fail.rs b/tests/ui/rust-2018/uniform-paths/prelude-fail.rs
new file mode 100644
index 00000000000..48c33d720dc
--- /dev/null
+++ b/tests/ui/rust-2018/uniform-paths/prelude-fail.rs
@@ -0,0 +1,6 @@
+// edition:2018
+
+// Tool attribute
+use rustfmt::skip as imported_rustfmt_skip; //~ ERROR unresolved import `rustfmt`
+
+fn main() {}
diff --git a/tests/ui/rust-2018/uniform-paths/prelude-fail.stderr b/tests/ui/rust-2018/uniform-paths/prelude-fail.stderr
new file mode 100644
index 00000000000..97d4c736751
--- /dev/null
+++ b/tests/ui/rust-2018/uniform-paths/prelude-fail.stderr
@@ -0,0 +1,9 @@
+error[E0432]: unresolved import `rustfmt`
+  --> $DIR/prelude-fail.rs:4:5
+   |
+LL | use rustfmt::skip as imported_rustfmt_skip;
+   |     ^^^^^^^ `rustfmt` is a tool module, not a module
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0432`.
diff --git a/tests/ui/rust-2018/uniform-paths/prelude.rs b/tests/ui/rust-2018/uniform-paths/prelude.rs
new file mode 100644
index 00000000000..65763614ce0
--- /dev/null
+++ b/tests/ui/rust-2018/uniform-paths/prelude.rs
@@ -0,0 +1,22 @@
+// build-pass (FIXME(62277): could be check-pass?)
+// edition:2018
+
+// Macro imported with `#[macro_use] extern crate`
+use vec as imported_vec;
+
+// Standard library prelude
+use Vec as ImportedVec;
+
+// Built-in type
+use u8 as imported_u8;
+
+// Built-in macro
+use env as env_imported;
+
+type A = imported_u8;
+
+fn main() {
+    imported_vec![0];
+    ImportedVec::<u8>::new();
+    env_imported!("PATH");
+}
diff --git a/tests/ui/rust-2018/uniform-paths/redundant.rs b/tests/ui/rust-2018/uniform-paths/redundant.rs
new file mode 100644
index 00000000000..fd7fc7fbd41
--- /dev/null
+++ b/tests/ui/rust-2018/uniform-paths/redundant.rs
@@ -0,0 +1,20 @@
+// run-pass
+// edition:2018
+
+use std;
+use std::io;
+
+mod foo {
+    pub use std as my_std;
+}
+
+mod bar {
+    pub use std::{self};
+}
+
+fn main() {
+    let _ = io::stdout();
+    let _ = self::std::io::stdout();
+    let _ = foo::my_std::io::stdout();
+    let _ = bar::std::io::stdout();
+}