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.
This commit is contained in:
parent
e305df1846
commit
8a47e08845
2 changed files with 28 additions and 0 deletions
14
src/test/ui/suggestions/issue-57672.rs
Normal file
14
src/test/ui/suggestions/issue-57672.rs
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
// aux-build:foo.rs
|
||||
// compile-flags:--extern foo
|
||||
// edition:2018
|
||||
|
||||
#![deny(unused_extern_crates)]
|
||||
|
||||
extern crate foo as foo_renamed;
|
||||
//~^ ERROR `extern crate` is not idiomatic in the new edition
|
||||
|
||||
pub mod m {
|
||||
pub use foo_renamed::Foo;
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
14
src/test/ui/suggestions/issue-57672.stderr
Normal file
14
src/test/ui/suggestions/issue-57672.stderr
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
error: `extern crate` is not idiomatic in the new edition
|
||||
--> $DIR/issue-57672.rs:7:1
|
||||
|
|
||||
LL | extern crate foo as foo_renamed;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: convert it to a `use`
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/issue-57672.rs:5:9
|
||||
|
|
||||
LL | #![deny(unused_extern_crates)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue