-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(resolve): update the ambiguity glob binding recursively
- Loading branch information
Showing
11 changed files
with
207 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// edition: 2021 | ||
// check-pass | ||
|
||
mod abc { | ||
pub struct Beeblebrox; | ||
pub struct Zaphod; | ||
} | ||
|
||
mod foo { | ||
pub mod bar { | ||
use crate::abc::*; | ||
|
||
#[derive(Debug)] | ||
pub enum Zaphod { | ||
Whale, | ||
President, | ||
} | ||
} | ||
pub use bar::*; | ||
} | ||
|
||
mod baz { | ||
pub fn do_something() { | ||
println!("{:?}", crate::foo::Zaphod::Whale); | ||
} | ||
} | ||
|
||
fn main() { | ||
baz::do_something(); | ||
} |
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,16 @@ | ||
// edition: 2021 | ||
|
||
pub fn foo() -> u32 { | ||
use sub::*; | ||
C //~ERROR `C` is ambiguous | ||
} | ||
|
||
mod sub { | ||
mod mod1 { pub const C: u32 = 1; } | ||
mod mod2 { pub const C: u32 = 2; } | ||
|
||
pub use mod1::*; | ||
pub use mod2::*; | ||
} | ||
|
||
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,23 @@ | ||
error[E0659]: `C` is ambiguous | ||
--> $DIR/issue-112713.rs:5:5 | ||
| | ||
LL | C | ||
| ^ ambiguous name | ||
| | ||
= note: ambiguous because of multiple glob imports of a name in the same module | ||
note: `C` could refer to the constant imported here | ||
--> $DIR/issue-112713.rs:12:13 | ||
| | ||
LL | pub use mod1::*; | ||
| ^^^^^^^ | ||
= help: consider adding an explicit import of `C` to disambiguate | ||
note: `C` could also refer to the constant imported here | ||
--> $DIR/issue-112713.rs:13:13 | ||
| | ||
LL | pub use mod2::*; | ||
| ^^^^^^^ | ||
= help: consider adding an explicit import of `C` to disambiguate | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0659`. |
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,25 @@ | ||
// https://github.com/rust-lang/rust/pull/112743#issuecomment-1601986883 | ||
|
||
macro_rules! m { | ||
() => { | ||
pub fn EVP_PKEY_id() {} | ||
}; | ||
} | ||
|
||
mod openssl { | ||
pub use self::evp::*; | ||
pub use self::handwritten::*; | ||
|
||
mod evp { | ||
m!(); | ||
} | ||
|
||
mod handwritten { | ||
m!(); | ||
} | ||
} | ||
use openssl::*; | ||
|
||
fn main() { | ||
EVP_PKEY_id(); //~ ERROR `EVP_PKEY_id` is ambiguous | ||
} |
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,23 @@ | ||
error[E0659]: `EVP_PKEY_id` is ambiguous | ||
--> $DIR/issue-112743.rs:24:5 | ||
| | ||
LL | EVP_PKEY_id(); | ||
| ^^^^^^^^^^^ ambiguous name | ||
| | ||
= note: ambiguous because of multiple glob imports of a name in the same module | ||
note: `EVP_PKEY_id` could refer to the function imported here | ||
--> $DIR/issue-112743.rs:10:13 | ||
| | ||
LL | pub use self::evp::*; | ||
| ^^^^^^^^^^^^ | ||
= help: consider adding an explicit import of `EVP_PKEY_id` to disambiguate | ||
note: `EVP_PKEY_id` could also refer to the function imported here | ||
--> $DIR/issue-112743.rs:11:13 | ||
| | ||
LL | pub use self::handwritten::*; | ||
| ^^^^^^^^^^^^^^^^^^^^ | ||
= help: consider adding an explicit import of `EVP_PKEY_id` to disambiguate | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0659`. |
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,21 @@ | ||
// check-pass | ||
|
||
mod a { | ||
pub trait P {} | ||
} | ||
pub use a::*; | ||
|
||
mod b { | ||
#[derive(Clone)] | ||
pub enum P { | ||
A | ||
} | ||
} | ||
pub use b::P; | ||
|
||
mod c { | ||
use crate::*; | ||
pub struct S(Vec<P>); | ||
} | ||
|
||
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,18 @@ | ||
// check-pass | ||
|
||
struct Foo; | ||
|
||
mod foo { | ||
use super::*; | ||
|
||
#[derive(Debug)] | ||
pub struct Foo; | ||
} | ||
|
||
mod bar { | ||
use super::foo::*; | ||
|
||
fn bar(_: Foo) {} | ||
} | ||
|
||
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,26 @@ | ||
// check-pass | ||
|
||
use thing::*; | ||
|
||
#[derive(Debug)] | ||
pub enum Thing { | ||
Foo, | ||
} | ||
|
||
#[cfg(test)] | ||
mod tests { | ||
use super::*; | ||
|
||
#[test] | ||
fn test_thing() { | ||
let thing = Thing::Foo; | ||
} | ||
} | ||
|
||
mod thing { | ||
pub enum Thing { | ||
Bar, | ||
} | ||
} | ||
|
||
fn main() {} |