forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#57557 - petrochenkov:ecused, r=varkor
resolve: Mark extern crate items as used in more cases Fixes rust-lang#57421
- Loading branch information
Showing
3 changed files
with
69 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Extern crate items are marked as used if they are used | ||
// through extern prelude entries introduced by them. | ||
|
||
// edition:2018 | ||
|
||
#![deny(unused_extern_crates)] | ||
|
||
extern crate core as iso1; //~ ERROR `extern crate` is not idiomatic in the new edition | ||
extern crate core as iso2; //~ ERROR `extern crate` is not idiomatic in the new edition | ||
extern crate core as iso3; //~ ERROR `extern crate` is not idiomatic in the new edition | ||
extern crate core as iso4; //~ ERROR `extern crate` is not idiomatic in the new edition | ||
|
||
// Doesn't introduce its extern prelude entry, so it's still considered unused. | ||
extern crate core; //~ ERROR unused extern crate | ||
|
||
mod m { | ||
use iso1::any as are_you_okay1; | ||
use ::iso2::any as are_you_okay2; | ||
type AreYouOkay1 = iso3::any::Any; | ||
type AreYouOkay2 = ::iso4::any::Any; | ||
|
||
use core::any as are_you_okay3; | ||
use ::core::any as are_you_okay4; | ||
type AreYouOkay3 = core::any::Any; | ||
type AreYouOkay4 = ::core::any::Any; | ||
} | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
error: `extern crate` is not idiomatic in the new edition | ||
--> $DIR/extern-crate-used.rs:8:1 | ||
| | ||
LL | extern crate core as iso1; //~ ERROR `extern crate` is not idiomatic in the new edition | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: convert it to a `use` | ||
| | ||
note: lint level defined here | ||
--> $DIR/extern-crate-used.rs:6:9 | ||
| | ||
LL | #![deny(unused_extern_crates)] | ||
| ^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: `extern crate` is not idiomatic in the new edition | ||
--> $DIR/extern-crate-used.rs:9:1 | ||
| | ||
LL | extern crate core as iso2; //~ ERROR `extern crate` is not idiomatic in the new edition | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: convert it to a `use` | ||
|
||
error: `extern crate` is not idiomatic in the new edition | ||
--> $DIR/extern-crate-used.rs:10:1 | ||
| | ||
LL | extern crate core as iso3; //~ ERROR `extern crate` is not idiomatic in the new edition | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: convert it to a `use` | ||
|
||
error: `extern crate` is not idiomatic in the new edition | ||
--> $DIR/extern-crate-used.rs:11:1 | ||
| | ||
LL | extern crate core as iso4; //~ ERROR `extern crate` is not idiomatic in the new edition | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: convert it to a `use` | ||
|
||
error: unused extern crate | ||
--> $DIR/extern-crate-used.rs:14:1 | ||
| | ||
LL | extern crate core; //~ ERROR unused extern crate | ||
| ^^^^^^^^^^^^^^^^^^ help: remove it | ||
|
||
error: aborting due to 5 previous errors | ||
|