From df687bdae0cc58e6cc4c62f8f3ca3c5bb7e7103b Mon Sep 17 00:00:00 2001 From: Noah Lev Date: Sun, 26 Sep 2021 12:21:44 -0700 Subject: [PATCH] Add regression test for issue #83564 --- .../core-std-import-order-issue-83564.rs | 10 ++++++++++ .../core-std-import-order-issue-83564.stderr | 16 ++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 src/test/ui/suggestions/core-std-import-order-issue-83564.rs create mode 100644 src/test/ui/suggestions/core-std-import-order-issue-83564.stderr diff --git a/src/test/ui/suggestions/core-std-import-order-issue-83564.rs b/src/test/ui/suggestions/core-std-import-order-issue-83564.rs new file mode 100644 index 0000000000000..b7fe5af7bf8a1 --- /dev/null +++ b/src/test/ui/suggestions/core-std-import-order-issue-83564.rs @@ -0,0 +1,10 @@ +// edition:2018 + +// This is a regression test for #83564. +// For some reason, Rust 2018 or higher is required to reproduce the bug. + +fn main() { + //~^ HELP consider importing one of these items + let _x = NonZeroU32::new(5).unwrap(); + //~^ ERROR failed to resolve: use of undeclared type `NonZeroU32` +} diff --git a/src/test/ui/suggestions/core-std-import-order-issue-83564.stderr b/src/test/ui/suggestions/core-std-import-order-issue-83564.stderr new file mode 100644 index 0000000000000..d484fb8cbe0d8 --- /dev/null +++ b/src/test/ui/suggestions/core-std-import-order-issue-83564.stderr @@ -0,0 +1,16 @@ +error[E0433]: failed to resolve: use of undeclared type `NonZeroU32` + --> $DIR/core-std-import-order-issue-83564.rs:8:14 + | +LL | let _x = NonZeroU32::new(5).unwrap(); + | ^^^^^^^^^^ not found in this scope + | +help: consider importing one of these items + | +LL | use std::num::NonZeroU32; + | +LL | use core::num::NonZeroU32; + | + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0433`.