Skip to content

Items with 'lexical' scope have poor scoping #23880

Closed
@nrc

Description

@nrc

E.g.,

struct Foo;

impl Foo {
    fn bar(&self) {}

    fn foo(&self) {
        fn bar(x: &Foo) {}

        bar(self);
    }
}

fn main() {}

Is an error, but shouldn't be, because the bar method hides the locally declared bar function inside foo.

I think this is a bug, so it shouldn't be on any milestone, but nominating just in case.

Metadata

Metadata

Assignees

Labels

A-resolveArea: Name/path resolution done by `rustc_resolve` specificallyP-mediumMedium priorityT-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