rustc_typeck: don't lint non-extern-prelude extern crate's in Rust 2018.
This commit is contained in:
parent
e90985acde
commit
81ca8ebee2
6 changed files with 34 additions and 88 deletions
|
|
@ -14,6 +14,7 @@
|
|||
// aux-build:remove-extern-crate.rs
|
||||
// compile-flags:--extern remove_extern_crate
|
||||
|
||||
#![feature(alloc)]
|
||||
#![warn(rust_2018_idioms)]
|
||||
|
||||
|
||||
|
|
@ -22,11 +23,16 @@ use remove_extern_crate;
|
|||
#[macro_use]
|
||||
extern crate remove_extern_crate as something_else;
|
||||
|
||||
// Shouldn't suggest changing to `use`, as the `alloc`
|
||||
// crate is not in the extern prelude - see #54381.
|
||||
extern crate alloc;
|
||||
|
||||
fn main() {
|
||||
another_name::mem::drop(3);
|
||||
another::foo();
|
||||
remove_extern_crate::foo!();
|
||||
bar!();
|
||||
alloc::vec![5];
|
||||
}
|
||||
|
||||
mod another {
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@
|
|||
// aux-build:remove-extern-crate.rs
|
||||
// compile-flags:--extern remove_extern_crate
|
||||
|
||||
#![feature(alloc)]
|
||||
#![warn(rust_2018_idioms)]
|
||||
|
||||
extern crate core;
|
||||
|
|
@ -22,11 +23,16 @@ use remove_extern_crate;
|
|||
#[macro_use]
|
||||
extern crate remove_extern_crate as something_else;
|
||||
|
||||
// Shouldn't suggest changing to `use`, as the `alloc`
|
||||
// crate is not in the extern prelude - see #54381.
|
||||
extern crate alloc;
|
||||
|
||||
fn main() {
|
||||
another_name::mem::drop(3);
|
||||
another::foo();
|
||||
remove_extern_crate::foo!();
|
||||
bar!();
|
||||
alloc::vec![5];
|
||||
}
|
||||
|
||||
mod another {
|
||||
|
|
|
|||
|
|
@ -1,24 +1,24 @@
|
|||
warning: unused extern crate
|
||||
--> $DIR/remove-extern-crate.rs:19:1
|
||||
--> $DIR/remove-extern-crate.rs:20:1
|
||||
|
|
||||
LL | extern crate core;
|
||||
| ^^^^^^^^^^^^^^^^^^ help: remove it
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/remove-extern-crate.rs:17:9
|
||||
--> $DIR/remove-extern-crate.rs:18:9
|
||||
|
|
||||
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:20:1
|
||||
--> $DIR/remove-extern-crate.rs:21:1
|
||||
|
|
||||
LL | extern crate core as another_name;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: convert it to a `use`
|
||||
|
||||
warning: `extern crate` is not idiomatic in the new edition
|
||||
--> $DIR/remove-extern-crate.rs:33:5
|
||||
--> $DIR/remove-extern-crate.rs:39:5
|
||||
|
|
||||
LL | extern crate core;
|
||||
| ^^^^^^^^^^^^^^^^^^ help: convert it to a `use`
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue