Skip to content

shadowed traits from glob imports in the same scope get ignored #144993

@lcnr

Description

@lcnr

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 #144131 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-resolveArea: Name/path resolution done by `rustc_resolve` specificallyC-bugCategory: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions