Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

undocumented behavior: glob imports cannot shadow non-glob imports #1615

Open
lolbinarycat opened this issue Sep 16, 2024 · 2 comments
Open

Comments

@lolbinarycat
Copy link

mod a {
pub fn b() { print!("1") }
}

mod c {
pub fn b() {
print!("2")
}
}

pub use c::b;
pub use a::*;
fn main() {
b(); // this prints "2"!
}

@ehuss
Copy link
Contributor

ehuss commented Sep 16, 2024

Thanks for the report! I'm uncertain, but it seems to me like this is documented in the glob imports section. It says that named imports will shadow conflicting names from a glob import. Does that cover what you are thinking?

@lolbinarycat
Copy link
Author

i guess, but the phrasing is pretty confusing. specifically, the usage of "are allowed to" instead of "always will". the example also doesn't make it clear that order doesn't matter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants