Skip to content

Resolve: fix scoping bug (fixes #31845) and improve unused import detection#31857

Merged
bors merged 2 commits intorust-lang:masterfrom
jseyfried:fix_scoping
Feb 26, 2016
Merged

Resolve: fix scoping bug (fixes #31845) and improve unused import detection#31857
bors merged 2 commits intorust-lang:masterfrom
jseyfried:fix_scoping

Conversation

@jseyfried
Copy link
Copy Markdown
Contributor

This fixes a bug (#31845) introduced in #31105 in which lexical scopes contain items from all anonymous module ancestors, even if the path to the anonymous module includes a normal module:

fn f() {
    fn g() {}
    mod foo {
        fn h() {
           g(); // This erroneously resolves on nightly
        }
    }
}

This is a [breaking-change] on nightly but not on stable or beta.
r? @nikomatsakis

@jseyfried
Copy link
Copy Markdown
Contributor Author

cc @petrochenkov

@nikomatsakis
Copy link
Copy Markdown
Contributor

@jseyfried to be clear, by "breaking change" you mean "bug fix", right? Seems clear this was never intended to work.

@nikomatsakis
Copy link
Copy Markdown
Contributor

@bors r+

@bors
Copy link
Copy Markdown
Collaborator

bors commented Feb 25, 2016

📌 Commit 2942cf7 has been approved by nikomatsakis

@jseyfried
Copy link
Copy Markdown
Contributor Author

Yeah, this is definitely a bug fix. I was using "[breaking-change]" in the most literal way, i.e. a change that can break code that used to compile, correctly or not. Is this not the intended meaning?

@bors
Copy link
Copy Markdown
Collaborator

bors commented Feb 26, 2016

⌛ Testing commit 2942cf7 with merge 9c6a008...

bors added a commit that referenced this pull request Feb 26, 2016
This fixes a bug (#31845) introduced in #31105 in which lexical scopes contain items from all anonymous module ancestors, even if the path to the anonymous module includes a normal module:
```rust
fn f() {
    fn g() {}
    mod foo {
        fn h() {
           g(); // This erroneously resolves on nightly
        }
    }
}
```

This is a [breaking-change] on nightly but not on stable or beta.
r? @nikomatsakis
@bors bors merged commit 2942cf7 into rust-lang:master Feb 26, 2016
@jseyfried jseyfried deleted the fix_scoping branch March 25, 2016 22:56
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

Successfully merging this pull request may close these issues.

3 participants