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#127854 - fmease:glob-import-type_ir_inheren…
…t-lint, r=compiler-errors Add internal lint for detecting non-glob imports of `rustc_type_ir::inherent` rust-lang#127627 (comment) r? compiler-errors
- Loading branch information
Showing
9 changed files
with
167 additions
and
2 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
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
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
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
37 changes: 37 additions & 0 deletions
37
tests/ui-fulldeps/internal-lints/non_glob_import_of_type_ir_inherent.rs
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,37 @@ | ||
//@ compile-flags: -Z unstable-options | ||
#![feature(rustc_private)] | ||
#![deny(rustc::non_glob_import_of_type_ir_inherent)] | ||
|
||
extern crate rustc_type_ir; | ||
|
||
mod ok { | ||
use rustc_type_ir::inherent::*; // OK | ||
use rustc_type_ir::inherent::{}; // OK | ||
use rustc_type_ir::inherent::{*}; // OK | ||
|
||
fn usage<T: rustc_type_ir::inherent::SliceLike>() {} // OK | ||
} | ||
|
||
mod direct { | ||
use rustc_type_ir::inherent::Predicate; //~ ERROR non-glob import of `rustc_type_ir::inherent` | ||
use rustc_type_ir::inherent::{AdtDef, Ty}; | ||
//~^ ERROR non-glob import of `rustc_type_ir::inherent` | ||
//~| ERROR non-glob import of `rustc_type_ir::inherent` | ||
use rustc_type_ir::inherent::ParamEnv as _; //~ ERROR non-glob import of `rustc_type_ir::inherent` | ||
} | ||
|
||
mod indirect0 { | ||
use rustc_type_ir::inherent; //~ ERROR non-glob import of `rustc_type_ir::inherent` | ||
use rustc_type_ir::inherent as inh; //~ ERROR non-glob import of `rustc_type_ir::inherent` | ||
use rustc_type_ir::{inherent as _}; //~ ERROR non-glob import of `rustc_type_ir::inherent` | ||
|
||
fn usage0<T: inherent::SliceLike>() {} | ||
fn usage1<T: inh::SliceLike>() {} | ||
} | ||
|
||
mod indirect1 { | ||
use rustc_type_ir::inherent::{self}; //~ ERROR non-glob import of `rustc_type_ir::inherent` | ||
use rustc_type_ir::inherent::{self as innate}; //~ ERROR non-glob import of `rustc_type_ir::inherent` | ||
} | ||
|
||
fn main() {} |
68 changes: 68 additions & 0 deletions
68
tests/ui-fulldeps/internal-lints/non_glob_import_of_type_ir_inherent.stderr
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,68 @@ | ||
error: non-glob import of `rustc_type_ir::inherent` | ||
--> $DIR/non_glob_import_of_type_ir_inherent.rs:16:9 | ||
| | ||
LL | use rustc_type_ir::inherent::Predicate; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^--------- | ||
| | | ||
| help: try using a glob import instead: `*` | ||
| | ||
note: the lint level is defined here | ||
--> $DIR/non_glob_import_of_type_ir_inherent.rs:3:9 | ||
| | ||
LL | #![deny(rustc::non_glob_import_of_type_ir_inherent)] | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: non-glob import of `rustc_type_ir::inherent` | ||
--> $DIR/non_glob_import_of_type_ir_inherent.rs:17:35 | ||
| | ||
LL | use rustc_type_ir::inherent::{AdtDef, Ty}; | ||
| ^^^^^^ help: try using a glob import instead: `*` | ||
|
||
error: non-glob import of `rustc_type_ir::inherent` | ||
--> $DIR/non_glob_import_of_type_ir_inherent.rs:17:43 | ||
| | ||
LL | use rustc_type_ir::inherent::{AdtDef, Ty}; | ||
| ^^ help: try using a glob import instead: `*` | ||
|
||
error: non-glob import of `rustc_type_ir::inherent` | ||
--> $DIR/non_glob_import_of_type_ir_inherent.rs:20:9 | ||
| | ||
LL | use rustc_type_ir::inherent::ParamEnv as _; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^------------- | ||
| | | ||
| help: try using a glob import instead: `*` | ||
|
||
error: non-glob import of `rustc_type_ir::inherent` | ||
--> $DIR/non_glob_import_of_type_ir_inherent.rs:24:9 | ||
| | ||
LL | use rustc_type_ir::inherent; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^- help: try using a glob import instead: `::*` | ||
|
||
error: non-glob import of `rustc_type_ir::inherent` | ||
--> $DIR/non_glob_import_of_type_ir_inherent.rs:25:9 | ||
| | ||
LL | use rustc_type_ir::inherent as inh; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^------- help: try using a glob import instead: `::*` | ||
|
||
error: non-glob import of `rustc_type_ir::inherent` | ||
--> $DIR/non_glob_import_of_type_ir_inherent.rs:26:25 | ||
| | ||
LL | use rustc_type_ir::{inherent as _}; | ||
| ^^^^^^^^----- help: try using a glob import instead: `::*` | ||
|
||
error: non-glob import of `rustc_type_ir::inherent` | ||
--> $DIR/non_glob_import_of_type_ir_inherent.rs:33:35 | ||
| | ||
LL | use rustc_type_ir::inherent::{self}; | ||
| ^^^^ help: try using a glob import instead: `*` | ||
|
||
error: non-glob import of `rustc_type_ir::inherent` | ||
--> $DIR/non_glob_import_of_type_ir_inherent.rs:34:35 | ||
| | ||
LL | use rustc_type_ir::inherent::{self as innate}; | ||
| ^^^^---------- | ||
| | | ||
| help: try using a glob import instead: `*` | ||
|
||
error: aborting due to 9 previous errors | ||
|