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#112413 - jieyouxu:fix-hidden-glob-reexports…
…-span-order, r=petrochenkov Adjust span labels for `HIDDEN_GLOB_REEXPORTS` Addresses rust-lang#111378 (comment). ### Before This PR The possibility that the private item comes before the glob re-export was not account for, causing the span label messages to say "but private item here shadows it" before "the name `Foo` in the type namespace is supposed to be publicly re-exported here". ### After This PR ```rust warning: private item shadows public glob re-export --> $DIR/hidden_glob_reexports.rs:9:5 | LL | struct Foo; | ^^^^^^^^^^^ the private item here shadows the name `Foo` in the type namespace ... LL | pub use self::inner::*; | -------------- but it is supposed to be publicly re-exported here | = note: `#[warn(hidden_glob_reexports)]` on by default warning: private item shadows public glob re-export --> $DIR/hidden_glob_reexports.rs:27:9 | LL | pub use self::inner::*; | -------------- the name `Foo` in the type namespace is supposed to be publicly re-exported here LL | LL | use self::other::Foo; | ^^^^^^^^^^^^^^^^ but the private item here shadows it ```
- Loading branch information
Showing
3 changed files
with
38 additions
and
15 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,54 @@ | ||
warning: private item shadows public glob re-export | ||
--> $DIR/hidden_glob_reexports.rs:11:5 | ||
--> $DIR/hidden_glob_reexports.rs:9:5 | ||
| | ||
LL | pub use self::inner::*; | ||
| -------------- the name `Foo` in the type namespace is supposed to be publicly re-exported here | ||
LL | | ||
LL | struct Foo; | ||
| ^^^^^^^^^^^ but the private item here shadows it | ||
| ^^^^^^^^^^^ | ||
| | ||
note: the name `Foo` in the type namespace is supposed to be publicly re-exported here | ||
--> $DIR/hidden_glob_reexports.rs:12:13 | ||
| | ||
LL | pub use self::inner::*; | ||
| ^^^^^^^^^^^^^^ | ||
note: but the private item here shadows it | ||
--> $DIR/hidden_glob_reexports.rs:9:5 | ||
| | ||
LL | struct Foo; | ||
| ^^^^^^^^^^^ | ||
= note: `#[warn(hidden_glob_reexports)]` on by default | ||
|
||
warning: private item shadows public glob re-export | ||
--> $DIR/hidden_glob_reexports.rs:27:9 | ||
| | ||
LL | use self::other::Foo; | ||
| ^^^^^^^^^^^^^^^^ | ||
| | ||
note: the name `Foo` in the type namespace is supposed to be publicly re-exported here | ||
--> $DIR/hidden_glob_reexports.rs:25:13 | ||
| | ||
LL | pub use self::inner::*; | ||
| -------------- the name `Foo` in the type namespace is supposed to be publicly re-exported here | ||
LL | | ||
| ^^^^^^^^^^^^^^ | ||
note: but the private item here shadows it | ||
--> $DIR/hidden_glob_reexports.rs:27:9 | ||
| | ||
LL | use self::other::Foo; | ||
| ^^^^^^^^^^^^^^^^ but the private item here shadows it | ||
| ^^^^^^^^^^^^^^^^ | ||
|
||
warning: private item shadows public glob re-export | ||
--> $DIR/hidden_glob_reexports.rs:40:9 | ||
| | ||
LL | use std::primitive::u8; | ||
| ^^^^^^^^^^^^^^^^^^ | ||
| | ||
note: the name `u8` in the type namespace is supposed to be publicly re-exported here | ||
--> $DIR/hidden_glob_reexports.rs:38:13 | ||
| | ||
LL | pub use self::no_def_id::*; | ||
| ------------------ the name `u8` in the type namespace is supposed to be publicly re-exported here | ||
LL | | ||
| ^^^^^^^^^^^^^^^^^^ | ||
note: but the private item here shadows it | ||
--> $DIR/hidden_glob_reexports.rs:40:9 | ||
| | ||
LL | use std::primitive::u8; | ||
| ^^^^^^^^^^^^^^^^^^ but the private item here shadows it | ||
| ^^^^^^^^^^^^^^^^^^ | ||
|
||
warning: 3 warnings emitted | ||
|