summaryrefslogtreecommitdiffstats
path: root/src/test/ui/uniform-paths
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:18:58 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:18:58 +0000
commita4b7ed7a42c716ab9f05e351f003d589124fd55d (patch)
treeb620cd3f223850b28716e474e80c58059dca5dd4 /src/test/ui/uniform-paths
parentAdding upstream version 1.67.1+dfsg1. (diff)
downloadrustc-a4b7ed7a42c716ab9f05e351f003d589124fd55d.tar.xz
rustc-a4b7ed7a42c716ab9f05e351f003d589124fd55d.zip
Adding upstream version 1.68.2+dfsg1.upstream/1.68.2+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/ui/uniform-paths')
-rw-r--r--src/test/ui/uniform-paths/auxiliary/issue-53691.rs7
-rw-r--r--src/test/ui/uniform-paths/basic-nested.rs61
-rw-r--r--src/test/ui/uniform-paths/basic.rs33
-rw-r--r--src/test/ui/uniform-paths/issue-53691.rs9
-rw-r--r--src/test/ui/uniform-paths/macros-nested.rs53
-rw-r--r--src/test/ui/uniform-paths/macros.rs36
-rw-r--r--src/test/ui/uniform-paths/same-crate.rs98
7 files changed, 0 insertions, 297 deletions
diff --git a/src/test/ui/uniform-paths/auxiliary/issue-53691.rs b/src/test/ui/uniform-paths/auxiliary/issue-53691.rs
deleted file mode 100644
index a46533178..000000000
--- a/src/test/ui/uniform-paths/auxiliary/issue-53691.rs
+++ /dev/null
@@ -1,7 +0,0 @@
-// edition:2018
-
-mod m { pub fn f() {} }
-mod n { pub fn g() {} }
-
-pub use m::f;
-pub use n::g;
diff --git a/src/test/ui/uniform-paths/basic-nested.rs b/src/test/ui/uniform-paths/basic-nested.rs
deleted file mode 100644
index dcf0eb646..000000000
--- a/src/test/ui/uniform-paths/basic-nested.rs
+++ /dev/null
@@ -1,61 +0,0 @@
-// This test is similar to `basic.rs`, but nested in modules.
-
-// run-pass
-// edition:2018
-
-#![feature(decl_macro)]
-
-#![allow(unused_imports)]
-#![allow(non_camel_case_types)]
-
-mod foo {
- // Test that ambiguity errors are not emitted between `self::test` and
- // `::test`, assuming the latter (crate) is not in `extern_prelude`.
- mod test {
- pub struct Foo(pub ());
- }
- pub use test::Foo;
-
- // Test that qualified paths can refer to both the external crate and local item.
- mod std {
- pub struct io(pub ());
- }
- pub use ::std::io as std_io;
- pub use self::std::io as local_io;
-}
-
-// Test that we can refer to the external crate unqualified
-// (when there isn't a local item with the same name).
-use std::io;
-
-mod bar {
- // Also test the unqualified external crate import in a nested module,
- // to show that the above import doesn't resolve through a local `std`
- // item, e.g., the automatically injected `extern crate std;`, which in
- // the Rust 2018 should no longer be visible through `crate::std`.
- pub use std::io;
-
- // Also test that items named `std` in other namespaces don't
- // cause ambiguity errors for the import from `std` above.
- pub fn std() {}
- pub macro std() {}
-}
-
-
-fn main() {
- foo::Foo(());
- let _ = foo::std_io::stdout();
- foo::local_io(());
- let _ = io::stdout();
- let _ = bar::io::stdout();
- bar::std();
- bar::std!();
-
- {
- // Test that having `io` in a module scope and a non-module
- // scope is allowed, when both resolve to the same definition.
- use std::io;
- use io::stdout;
- let _ = stdout();
- }
-}
diff --git a/src/test/ui/uniform-paths/basic.rs b/src/test/ui/uniform-paths/basic.rs
deleted file mode 100644
index ce611a7ca..000000000
--- a/src/test/ui/uniform-paths/basic.rs
+++ /dev/null
@@ -1,33 +0,0 @@
-// run-pass
-// edition:2018
-
-#![allow(unused_imports)]
-#![allow(non_camel_case_types)]
-
-// Test that ambiguity errors are not emitted between `self::test` and
-// `::test`, assuming the latter (crate) is not in `extern_prelude`.
-mod test {
- pub struct Foo(pub ());
-}
-use test::Foo;
-
-// Test that qualified paths can refer to both the external crate and local item.
-mod std {
- pub struct io(pub ());
-}
-use ::std::io as std_io;
-use self::std::io as local_io;
-
-fn main() {
- Foo(());
- let _ = std_io::stdout();
- local_io(());
-
- {
- // Test that having `std_io` in a module scope and a non-module
- // scope is allowed, when both resolve to the same definition.
- use ::std::io as std_io;
- use std_io::stdout;
- let _ = stdout();
- }
-}
diff --git a/src/test/ui/uniform-paths/issue-53691.rs b/src/test/ui/uniform-paths/issue-53691.rs
deleted file mode 100644
index 5c5ca5b70..000000000
--- a/src/test/ui/uniform-paths/issue-53691.rs
+++ /dev/null
@@ -1,9 +0,0 @@
-// run-pass
-// aux-build:issue-53691.rs
-
-extern crate issue_53691;
-
-fn main() {
- issue_53691::f();
- issue_53691::g();
-}
diff --git a/src/test/ui/uniform-paths/macros-nested.rs b/src/test/ui/uniform-paths/macros-nested.rs
deleted file mode 100644
index 175ccd34e..000000000
--- a/src/test/ui/uniform-paths/macros-nested.rs
+++ /dev/null
@@ -1,53 +0,0 @@
-// This test is similar to `macros.rs`, but nested in modules.
-
-// run-pass
-// edition:2018
-
-#![allow(non_camel_case_types)]
-
-mod foo {
- // Test that ambiguity errors are not emitted between `self::test` and
- // `::test`, assuming the latter (crate) is not in `extern_prelude`.
- macro_rules! m1 {
- () => {
- mod test {
- pub struct Foo(pub ());
- }
- }
- }
- pub use test::Foo;
- m1!();
-
- // Test that qualified paths can refer to both the external crate and local item.
- macro_rules! m2 {
- () => {
- mod std {
- pub struct io(pub ());
- }
- }
- }
- pub use ::std::io as std_io;
- pub use self::std::io as local_io;
- m2!();
-}
-
-// Test that we can refer to the external crate unqualified
-// (when there isn't a local item with the same name).
-use std::io;
-
-mod bar {
- // Also test the unqualified external crate import in a nested module,
- // to show that the above import doesn't resolve through a local `std`
- // item, e.g., the automatically injected `extern crate std;`, which in
- // the Rust 2018 should no longer be visible through `crate::std`.
- pub use std::io;
-}
-
-
-fn main() {
- foo::Foo(());
- let _ = foo::std_io::stdout();
- foo::local_io(());
- let _ = io::stdout();
- let _ = bar::io::stdout();
-}
diff --git a/src/test/ui/uniform-paths/macros.rs b/src/test/ui/uniform-paths/macros.rs
deleted file mode 100644
index bf512b305..000000000
--- a/src/test/ui/uniform-paths/macros.rs
+++ /dev/null
@@ -1,36 +0,0 @@
-// This test is similar to `basic.rs`, but with macros defining local items.
-
-// run-pass
-// edition:2018
-
-#![allow(non_camel_case_types)]
-
-// Test that ambiguity errors are not emitted between `self::test` and
-// `::test`, assuming the latter (crate) is not in `extern_prelude`.
-macro_rules! m1 {
- () => {
- mod test {
- pub struct Foo(pub ());
- }
- }
-}
-use test::Foo;
-m1!();
-
-// Test that qualified paths can refer to both the external crate and local item.
-macro_rules! m2 {
- () => {
- mod std {
- pub struct io(pub ());
- }
- }
-}
-use ::std::io as std_io;
-use self::std::io as local_io;
-m2!();
-
-fn main() {
- Foo(());
- let _ = std_io::stdout();
- local_io(());
-}
diff --git a/src/test/ui/uniform-paths/same-crate.rs b/src/test/ui/uniform-paths/same-crate.rs
deleted file mode 100644
index ce4cc13d9..000000000
--- a/src/test/ui/uniform-paths/same-crate.rs
+++ /dev/null
@@ -1,98 +0,0 @@
-// run-pass
-// edition:2018
-
-pub const A: usize = 0;
-
-pub mod foo {
- pub const B: usize = 1;
-
- pub mod bar {
- pub const C: usize = 2;
-
- pub enum E {
- V1(usize),
- V2(String),
- }
-
- pub fn test() -> String {
- format!("{} {} {}", crate::A, crate::foo::B, C)
- }
-
- pub fn test_use() -> String {
- use crate::A;
- use crate::foo::B;
-
- format!("{} {} {}", A, B, C)
- }
-
- pub fn test_enum() -> String {
- use E::*;
- match E::V1(10) {
- V1(i) => { format!("V1: {}", i) }
- V2(s) => { format!("V2: {}", s) }
- }
- }
- }
-
- pub fn test() -> String {
- format!("{} {} {}", crate::A, B, bar::C)
- }
-
- pub fn test_use() -> String {
- use crate::A;
- use bar::C;
-
- format!("{} {} {}", A, B, C)
- }
-
- pub fn test_enum() -> String {
- use bar::E::*;
- match bar::E::V1(10) {
- V1(i) => { format!("V1: {}", i) }
- V2(s) => { format!("V2: {}", s) }
- }
- }
-}
-
-pub fn test() -> String {
- format!("{} {} {}", A, foo::B, foo::bar::C)
-}
-
-pub fn test_use() -> String {
- use foo::B;
- use foo::bar::C;
-
- format!("{} {} {}", A, B, C)
-}
-
-pub fn test_enum() -> String {
- use foo::bar::E::*;
- match foo::bar::E::V1(10) {
- V1(i) => { format!("V1: {}", i) }
- V2(s) => { format!("V2: {}", s) }
- }
-}
-
-fn main() {
- let output = [
- test(),
- foo::test(),
- foo::bar::test(),
- test_use(),
- foo::test_use(),
- foo::bar::test_use(),
- test_enum(),
- foo::test_enum(),
- foo::bar::test_enum(),
- ].join("\n");
- assert_eq!(output, "\
-0 1 2
-0 1 2
-0 1 2
-0 1 2
-0 1 2
-0 1 2
-V1: 10
-V1: 10
-V1: 10");
-}