diff options
| author | Mara Bos <m-ou.se@m-ou.se> | 2021-08-30 19:21:40 +0200 |
|---|---|---|
| committer | Mara Bos <m-ou.se@m-ou.se> | 2021-08-30 19:21:40 +0200 |
| commit | 89a98675aafaebbc62fa9b76383902553124085c (patch) | |
| tree | 618b270782a2c8a9097a9dab0220a86a604574ea | |
| parent | 51e4fbaed15ca5e2c534cc4a3b4e992116044cdb (diff) | |
| download | rust-89a98675aafaebbc62fa9b76383902553124085c.tar.gz rust-89a98675aafaebbc62fa9b76383902553124085c.zip | |
Add test for glob imported prelude collision trait.
3 files changed, 32 insertions, 1 deletions
diff --git a/src/test/ui/rust-2021/future-prelude-collision-imported.fixed b/src/test/ui/rust-2021/future-prelude-collision-imported.fixed index c5ff0b4bcd0..15ccff7496e 100644 --- a/src/test/ui/rust-2021/future-prelude-collision-imported.fixed +++ b/src/test/ui/rust-2021/future-prelude-collision-imported.fixed @@ -56,4 +56,15 @@ mod c { } } +mod d { + use super::m::*; + + fn main() { + // See https://github.com/rust-lang/rust/issues/88471 + let _: u32 = TryIntoU32::try_into(3u8).unwrap(); + //~^ WARNING trait method `try_into` will become ambiguous in Rust 2021 + //~^^ WARNING this is accepted in the current edition + } +} + fn main() {} diff --git a/src/test/ui/rust-2021/future-prelude-collision-imported.rs b/src/test/ui/rust-2021/future-prelude-collision-imported.rs index cd39eec47f2..cdffcaf7545 100644 --- a/src/test/ui/rust-2021/future-prelude-collision-imported.rs +++ b/src/test/ui/rust-2021/future-prelude-collision-imported.rs @@ -56,4 +56,15 @@ mod c { } } +mod d { + use super::m::*; + + fn main() { + // See https://github.com/rust-lang/rust/issues/88471 + let _: u32 = 3u8.try_into().unwrap(); + //~^ WARNING trait method `try_into` will become ambiguous in Rust 2021 + //~^^ WARNING this is accepted in the current edition + } +} + fn main() {} diff --git a/src/test/ui/rust-2021/future-prelude-collision-imported.stderr b/src/test/ui/rust-2021/future-prelude-collision-imported.stderr index fbda5d61f36..56abb8abd4d 100644 --- a/src/test/ui/rust-2021/future-prelude-collision-imported.stderr +++ b/src/test/ui/rust-2021/future-prelude-collision-imported.stderr @@ -30,5 +30,14 @@ LL | let _: u32 = 3u8.try_into().unwrap(); = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021! = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/prelude.html> -warning: 3 warnings emitted +warning: trait method `try_into` will become ambiguous in Rust 2021 + --> $DIR/future-prelude-collision-imported.rs:64:22 + | +LL | let _: u32 = 3u8.try_into().unwrap(); + | ^^^^^^^^^^^^^^ help: disambiguate the associated function: `TryIntoU32::try_into(3u8)` + | + = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021! + = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/prelude.html> + +warning: 4 warnings emitted |
