Skip to content

Commit 8a47e08

Browse files
committed
Add test for current behaviour.
This commit adds a test that causes a suggestion to replace `extern crate` with `use` when doing so would cause a compliation error, as the new name of the import would not be added to the prelude if a `use` was used.
1 parent e305df1 commit 8a47e08

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed
+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// aux-build:foo.rs
2+
// compile-flags:--extern foo
3+
// edition:2018
4+
5+
#![deny(unused_extern_crates)]
6+
7+
extern crate foo as foo_renamed;
8+
//~^ ERROR `extern crate` is not idiomatic in the new edition
9+
10+
pub mod m {
11+
pub use foo_renamed::Foo;
12+
}
13+
14+
fn main() {}
+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
error: `extern crate` is not idiomatic in the new edition
2+
--> $DIR/issue-57672.rs:7:1
3+
|
4+
LL | extern crate foo as foo_renamed;
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: convert it to a `use`
6+
|
7+
note: lint level defined here
8+
--> $DIR/issue-57672.rs:5:9
9+
|
10+
LL | #![deny(unused_extern_crates)]
11+
| ^^^^^^^^^^^^^^^^^^^^
12+
13+
error: aborting due to previous error
14+

0 commit comments

Comments
 (0)