-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add warn-by-default lint for local binding shadowing exported glob re…
…-export item
- Loading branch information
Showing
12 changed files
with
207 additions
and
27 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// check-pass | ||
|
||
pub mod upstream_a { | ||
mod inner { | ||
pub struct Foo {} | ||
pub struct Bar {} | ||
} | ||
|
||
pub use self::inner::*; | ||
|
||
struct Foo; | ||
//~^ WARN private item shadows public glob re-export | ||
} | ||
|
||
pub mod upstream_b { | ||
mod inner { | ||
pub struct Foo {} | ||
pub struct Qux {} | ||
} | ||
|
||
mod other { | ||
pub struct Foo; | ||
} | ||
|
||
pub use self::inner::*; | ||
|
||
use self::other::Foo; | ||
//~^ WARN private item shadows public glob re-export | ||
} | ||
|
||
pub mod upstream_c { | ||
mod no_def_id { | ||
#![allow(non_camel_case_types)] | ||
pub struct u8; | ||
pub struct World; | ||
} | ||
|
||
pub use self::no_def_id::*; | ||
|
||
use std::primitive::u8; | ||
//~^ WARN private item shadows public glob re-export | ||
} | ||
|
||
// Downstream crate | ||
// mod downstream { | ||
// fn proof() { | ||
// let _ = crate::upstream_a::Foo; | ||
// let _ = crate::upstream_b::Foo; | ||
// } | ||
// } | ||
|
||
pub 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,31 @@ | ||
warning: private item shadows public glob re-export | ||
--> $DIR/hidden_glob_reexports.rs:11: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: `#[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 | ||
|
||
warning: private item shadows public glob re-export | ||
--> $DIR/hidden_glob_reexports.rs:40:9 | ||
| | ||
LL | pub use self::no_def_id::*; | ||
| ------------------ the name `u8` in the type namespace is supposed to be publicly re-exported here | ||
LL | | ||
LL | use std::primitive::u8; | ||
| ^^^^^^^^^^^^^^^^^^ but the private item here shadows it | ||
|
||
warning: 3 warnings emitted | ||
|