shadowed traits from glob imports in the same scope get ignored
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
while glob imports from an outer/or nested scope do not
mod glob {
pub trait Tr {
fn method(&self) {}
}
impl Tr for () {}
}
// use glob::*; // ok
fn main() {
// use glob::*; // error
trait Tr {} // no method
{
use glob::*; // ok
().method();
}
}
cc @petrochenkov. I want to make sure it's tracked somewhere outside of #144131. Also just really enjoyed learning about this current behavior and wanted to use my test somehow 😁
Originally posted by @lcnr in https://github.com/rust-lang/rust/pull/144131#discussion_r2256790398
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Rust reproducer in the issue and compare glob-import trait resolution in the outer, nested, and same scopes. Read the discussion linked from PR #144131 to understand the existing behavior and intended resolution. Done means the same-scope case is handled consistently with the other scopes and the reproducer is covered by a regression test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100