summaryrefslogtreecommitdiff
path: root/tests/ui/rust-2018
diff options
context:
space:
mode:
authorCamille GILLOT <gillot.camille@gmail.com>2023-02-22 20:25:10 +0000
committerCamille GILLOT <gillot.camille@gmail.com>2023-02-22 20:48:27 +0000
commit958419d35480a9466c1c0f129fe919292e1633b2 (patch)
tree5fb13a922aab3419ef7f3479441b8fd43387ecce /tests/ui/rust-2018
parentb869e84e581612f4a30a4bca63bd9e90e9a17003 (diff)
Move the unused extern crate check back to the resolver.
Diffstat (limited to 'tests/ui/rust-2018')
-rw-r--r--tests/ui/rust-2018/remove-extern-crate.fixed10
-rw-r--r--tests/ui/rust-2018/remove-extern-crate.rs10
-rw-r--r--tests/ui/rust-2018/remove-extern-crate.stderr22
3 files changed, 39 insertions, 3 deletions
diff --git a/tests/ui/rust-2018/remove-extern-crate.fixed b/tests/ui/rust-2018/remove-extern-crate.fixed
index 832632268fb..15e0ccc5256 100644
--- a/tests/ui/rust-2018/remove-extern-crate.fixed
+++ b/tests/ui/rust-2018/remove-extern-crate.fixed
@@ -23,6 +23,7 @@ extern crate alloc;
fn main() {
another_name::mem::drop(3);
another::foo();
+ with_visibility::foo();
remove_extern_crate::foo!();
bar!();
alloc::vec![5];
@@ -37,3 +38,12 @@ mod another {
remove_extern_crate::foo!();
}
}
+
+mod with_visibility {
+ pub use core; //~ WARNING `extern crate` is not idiomatic
+
+ pub fn foo() {
+ core::mem::drop(4);
+ remove_extern_crate::foo!();
+ }
+}
diff --git a/tests/ui/rust-2018/remove-extern-crate.rs b/tests/ui/rust-2018/remove-extern-crate.rs
index bbb84cd462d..aec0bc7c374 100644
--- a/tests/ui/rust-2018/remove-extern-crate.rs
+++ b/tests/ui/rust-2018/remove-extern-crate.rs
@@ -23,6 +23,7 @@ extern crate alloc;
fn main() {
another_name::mem::drop(3);
another::foo();
+ with_visibility::foo();
remove_extern_crate::foo!();
bar!();
alloc::vec![5];
@@ -37,3 +38,12 @@ mod another {
remove_extern_crate::foo!();
}
}
+
+mod with_visibility {
+ pub extern crate core; //~ WARNING `extern crate` is not idiomatic
+
+ pub fn foo() {
+ core::mem::drop(4);
+ remove_extern_crate::foo!();
+ }
+}
diff --git a/tests/ui/rust-2018/remove-extern-crate.stderr b/tests/ui/rust-2018/remove-extern-crate.stderr
index bde4c180811..d07358e471b 100644
--- a/tests/ui/rust-2018/remove-extern-crate.stderr
+++ b/tests/ui/rust-2018/remove-extern-crate.stderr
@@ -12,10 +12,26 @@ LL | #![warn(rust_2018_idioms)]
= note: `#[warn(unused_extern_crates)]` implied by `#[warn(rust_2018_idioms)]`
warning: `extern crate` is not idiomatic in the new edition
- --> $DIR/remove-extern-crate.rs:32:5
+ --> $DIR/remove-extern-crate.rs:33:5
|
LL | extern crate core;
- | ^^^^^^^^^^^^^^^^^^ help: convert it to a `use`
+ | ^^^^^^^^^^^^^^^^^^
+ |
+help: convert it to a `use`
+ |
+LL | use core;
+ | ~~~
+
+warning: `extern crate` is not idiomatic in the new edition
+ --> $DIR/remove-extern-crate.rs:43:5
+ |
+LL | pub extern crate core;
+ | ^^^^^^^^^^^^^^^^^^^^^^
+ |
+help: convert it to a `use`
+ |
+LL | pub use core;
+ | ~~~
-warning: 2 warnings emitted
+warning: 3 warnings emitted