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

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

Merged
merged 2 commits into from
Feb 26, 2016

Conversation

jseyfried
Copy link
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
Contributor Author

cc @petrochenkov

@nikomatsakis
Copy link
Contributor

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

@nikomatsakis
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Feb 25, 2016

📌 Commit 2942cf7 has been approved by nikomatsakis

@jseyfried
Copy link
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
Contributor

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