From 218caa410aa38c29984be31a5229b9fa717560ee Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:19:13 +0200 Subject: Merging upstream version 1.68.2+dfsg1. Signed-off-by: Daniel Baumann --- tests/ui/imports/auxiliary/gensymed.rs | 3 ++ tests/ui/imports/auxiliary/glob-conflict.rs | 13 +++++++++ tests/ui/imports/auxiliary/import_crate_var.rs | 7 +++++ tests/ui/imports/auxiliary/issue-36881-aux.rs | 1 + tests/ui/imports/auxiliary/issue-52891.rs | 33 ++++++++++++++++++++++ tests/ui/imports/auxiliary/issue-55811.rs | 5 ++++ tests/ui/imports/auxiliary/issue-56125.rs | 11 ++++++++ tests/ui/imports/auxiliary/issue-59764.rs | 18 ++++++++++++ .../auxiliary/overlapping_pub_trait_source.rs | 13 +++++++++ tests/ui/imports/auxiliary/two_macros.rs | 5 ++++ .../imports/auxiliary/unnamed_pub_trait_source.rs | 13 +++++++++ 11 files changed, 122 insertions(+) create mode 100644 tests/ui/imports/auxiliary/gensymed.rs create mode 100644 tests/ui/imports/auxiliary/glob-conflict.rs create mode 100644 tests/ui/imports/auxiliary/import_crate_var.rs create mode 100644 tests/ui/imports/auxiliary/issue-36881-aux.rs create mode 100644 tests/ui/imports/auxiliary/issue-52891.rs create mode 100644 tests/ui/imports/auxiliary/issue-55811.rs create mode 100644 tests/ui/imports/auxiliary/issue-56125.rs create mode 100644 tests/ui/imports/auxiliary/issue-59764.rs create mode 100644 tests/ui/imports/auxiliary/overlapping_pub_trait_source.rs create mode 100644 tests/ui/imports/auxiliary/two_macros.rs create mode 100644 tests/ui/imports/auxiliary/unnamed_pub_trait_source.rs (limited to 'tests/ui/imports/auxiliary') 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 _; +} -- cgit v1.2.3