diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:13 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:13 +0000 |
commit | 218caa410aa38c29984be31a5229b9fa717560ee (patch) | |
tree | c54bd55eeb6e4c508940a30e94c0032fbd45d677 /tests/ui/imports/auxiliary | |
parent | Releasing progress-linux version 1.67.1+dfsg1-1~progress7.99u1. (diff) | |
download | rustc-218caa410aa38c29984be31a5229b9fa717560ee.tar.xz rustc-218caa410aa38c29984be31a5229b9fa717560ee.zip |
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/imports/auxiliary')
-rw-r--r-- | tests/ui/imports/auxiliary/gensymed.rs | 3 | ||||
-rw-r--r-- | tests/ui/imports/auxiliary/glob-conflict.rs | 13 | ||||
-rw-r--r-- | tests/ui/imports/auxiliary/import_crate_var.rs | 7 | ||||
-rw-r--r-- | tests/ui/imports/auxiliary/issue-36881-aux.rs | 1 | ||||
-rw-r--r-- | tests/ui/imports/auxiliary/issue-52891.rs | 33 | ||||
-rw-r--r-- | tests/ui/imports/auxiliary/issue-55811.rs | 5 | ||||
-rw-r--r-- | tests/ui/imports/auxiliary/issue-56125.rs | 11 | ||||
-rw-r--r-- | tests/ui/imports/auxiliary/issue-59764.rs | 18 | ||||
-rw-r--r-- | tests/ui/imports/auxiliary/overlapping_pub_trait_source.rs | 13 | ||||
-rw-r--r-- | tests/ui/imports/auxiliary/two_macros.rs | 5 | ||||
-rw-r--r-- | tests/ui/imports/auxiliary/unnamed_pub_trait_source.rs | 13 |
11 files changed, 122 insertions, 0 deletions
diff --git a/tests/ui/imports/auxiliary/gensymed.rs b/tests/ui/imports/auxiliary/gensymed.rs new file mode 100644 index 000000000..bbb19f5ec --- /dev/null +++ b/tests/ui/imports/auxiliary/gensymed.rs @@ -0,0 +1,3 @@ +// edition:2018 + +mod std {} diff --git a/tests/ui/imports/auxiliary/glob-conflict.rs b/tests/ui/imports/auxiliary/glob-conflict.rs new file mode 100644 index 000000000..c83db64c6 --- /dev/null +++ b/tests/ui/imports/auxiliary/glob-conflict.rs @@ -0,0 +1,13 @@ +mod m1 { + pub fn f() {} +} +mod m2 { + pub fn f(_: u8) {} +} + +pub use m1::*; +pub use m2::*; + +pub mod glob { + pub use *; +} diff --git a/tests/ui/imports/auxiliary/import_crate_var.rs b/tests/ui/imports/auxiliary/import_crate_var.rs new file mode 100644 index 000000000..a273b103a --- /dev/null +++ b/tests/ui/imports/auxiliary/import_crate_var.rs @@ -0,0 +1,7 @@ +pub fn f() {} + +#[macro_export] +macro_rules! m { () => { + use $crate; + import_crate_var::f(); +} } diff --git a/tests/ui/imports/auxiliary/issue-36881-aux.rs b/tests/ui/imports/auxiliary/issue-36881-aux.rs new file mode 100644 index 000000000..e373b6438 --- /dev/null +++ b/tests/ui/imports/auxiliary/issue-36881-aux.rs @@ -0,0 +1 @@ +pub trait Foo {} diff --git a/tests/ui/imports/auxiliary/issue-52891.rs b/tests/ui/imports/auxiliary/issue-52891.rs new file mode 100644 index 000000000..075981183 --- /dev/null +++ b/tests/ui/imports/auxiliary/issue-52891.rs @@ -0,0 +1,33 @@ +pub mod a { + pub mod inner { + } +} + +pub mod b { + pub mod inner { + } +} + +pub mod c {} + +pub mod d {} + +pub mod e {} + +pub mod f {} + +pub mod g {} + +pub mod h {} + +pub mod i {} + +pub mod j {} + +pub mod k {} + +pub mod l {} + +pub mod m {} + +pub mod n {} diff --git a/tests/ui/imports/auxiliary/issue-55811.rs b/tests/ui/imports/auxiliary/issue-55811.rs new file mode 100644 index 000000000..877e4cdb0 --- /dev/null +++ b/tests/ui/imports/auxiliary/issue-55811.rs @@ -0,0 +1,5 @@ +mod m {} + +// These two imports should not conflict when this crate is loaded from some other crate. +use m::{}; +use m::{}; diff --git a/tests/ui/imports/auxiliary/issue-56125.rs b/tests/ui/imports/auxiliary/issue-56125.rs new file mode 100644 index 000000000..8e0797582 --- /dev/null +++ b/tests/ui/imports/auxiliary/issue-56125.rs @@ -0,0 +1,11 @@ +pub mod issue_56125 {} + +pub mod last_segment { + pub mod issue_56125 {} +} + +pub mod non_last_segment { + pub mod non_last_segment { + pub mod issue_56125 {} + } +} diff --git a/tests/ui/imports/auxiliary/issue-59764.rs b/tests/ui/imports/auxiliary/issue-59764.rs new file mode 100644 index 000000000..a92eed968 --- /dev/null +++ b/tests/ui/imports/auxiliary/issue-59764.rs @@ -0,0 +1,18 @@ +pub mod foo { + #[macro_export] + macro_rules! makro { + ($foo:ident) => { + fn $foo() { } + } + } + + pub fn baz() {} + + pub fn foobar() {} + + pub mod barbaz { + pub fn barfoo() {} + } +} + +pub fn foobaz() {} diff --git a/tests/ui/imports/auxiliary/overlapping_pub_trait_source.rs b/tests/ui/imports/auxiliary/overlapping_pub_trait_source.rs new file mode 100644 index 000000000..2a25d60ac --- /dev/null +++ b/tests/ui/imports/auxiliary/overlapping_pub_trait_source.rs @@ -0,0 +1,13 @@ +/* This crate declares an item as both `prelude::*` and `m::Tr`. + * The compiler should always suggest `m::Tr`. */ + +pub struct S; + +pub mod prelude { + pub use crate::m::Tr as _; +} + +pub mod m { + pub trait Tr { fn method(&self); } + impl Tr for crate::S { fn method(&self) {} } +} diff --git a/tests/ui/imports/auxiliary/two_macros.rs b/tests/ui/imports/auxiliary/two_macros.rs new file mode 100644 index 000000000..92c211467 --- /dev/null +++ b/tests/ui/imports/auxiliary/two_macros.rs @@ -0,0 +1,5 @@ +#[macro_export] +macro_rules! m { ($($t:tt)*) => { $($t)* } } + +#[macro_export] +macro_rules! n { ($($t:tt)*) => { $($t)* } } diff --git a/tests/ui/imports/auxiliary/unnamed_pub_trait_source.rs b/tests/ui/imports/auxiliary/unnamed_pub_trait_source.rs new file mode 100644 index 000000000..d73c9a795 --- /dev/null +++ b/tests/ui/imports/auxiliary/unnamed_pub_trait_source.rs @@ -0,0 +1,13 @@ +/* This crate declares an item that is unnamed. + * Its only public path is through `prelude::*`. */ + +pub struct S; + +mod m { + pub trait Tr { fn method(&self); } + impl Tr for crate::S { fn method(&self) {} } +} + +pub mod prelude { + pub use crate::m::Tr as _; +} |