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

rustc_resolve: Refactor away NameBindings and ImportResolutionPerNamespace #30843

Merged
merged 4 commits into from
Jan 30, 2016

Conversation

jseyfried
Copy link
Contributor

This commit refactors the field Module::children from mapping Name -> NameBindings to mapping (Name, Namespace) -> NameBinding and refactors the field Module::import_resolutions from mapping Name -> ImportResolutionPerNamespace to mapping (Name, Namespace) -> ImportResolution.

This allows the duplicate checking code to be refactored so that NameBinding no longer needs ref-counting or a RefCell (removing the need for NsDef).

r? @nikomatsakis

@jseyfried jseyfried force-pushed the no_per_ns branch 5 times, most recently from a778203 to 07df703 Compare January 13, 2016 00:04
@jseyfried
Copy link
Contributor Author

I amended the commit to add a couple of comments and refactored some more code out of resolve_single_import.

@bors
Copy link
Contributor

bors commented Jan 14, 2016

☔ The latest upstream changes (presumably #30883) made this pull request unmergeable. Please resolve the merge conflicts.

@jseyfried jseyfried force-pushed the no_per_ns branch 4 times, most recently from 043c4fd to 7f3f96a Compare January 15, 2016 09:03
@bors
Copy link
Contributor

bors commented Jan 15, 2016

☔ The latest upstream changes (presumably #30929) made this pull request unmergeable. Please resolve the merge conflicts.

@nikomatsakis
Copy link
Contributor

Sorry for the delay in reviewing this! Working on it. Been a crazy week.

@bors
Copy link
Contributor

bors commented Jan 21, 2016

☔ The latest upstream changes (presumably #31010) made this pull request unmergeable. Please resolve the merge conflicts.

@bors
Copy link
Contributor

bors commented Jan 22, 2016

☔ The latest upstream changes (presumably #30882) made this pull request unmergeable. Please resolve the merge conflicts.

@jseyfried jseyfried force-pushed the no_per_ns branch 5 times, most recently from 708e175 to 6865bff Compare January 22, 2016 11:36
@jseyfried
Copy link
Contributor Author

@nikomatsakis No hurry, those first two upstream changes were PRs I backported from this branch and the other two didn't interact with this PR that much.

Let me know if you'd like me to explain, motivate, or justify the purity of anything in this refactoring.

I also have a branch a commit ahead of this one (diff) where I refactor away Module's external_module_children and another branch a commit after that (diff) where I fix issue #26775 by a "proper implementation" of what @nrc describes here, except with a small difference that significantly reduces breakage.

@nrc
Copy link
Member

nrc commented Jan 25, 2016

cc @petrochenkov

@nikomatsakis
Copy link
Contributor

@jseyfried as you can tell I still haven't gotten to it :) I hope to do so soon though. Last week was just a doozy. (The truth is, I don't know resolve as well as I would like, so your PRs always require me to read into the code quite a bit.)

UPDATE: But it's good for me. :)

@petrochenkov
Copy link
Contributor

build_reduced_graph.rs looks good to me

@jseyfried
Copy link
Contributor Author

@petrochenkov good points, thanks. I implemented your suggestions in the third commit.

@petrochenkov
Copy link
Contributor

jseyfried@521aaf2 reviewed, all the code seems to be moved correctly, it's hard to track though

@jseyfried jseyfried force-pushed the no_per_ns branch 2 times, most recently from ab53df5 to 100a9f6 Compare January 28, 2016 03:06
@nikomatsakis
Copy link
Contributor

OK, I feel pretty good about this change. @petrochenkov, your thoughts?

@petrochenkov
Copy link
Contributor

your thoughts?

resolve becomes 450 lines less scary, merge of course!

@bors
Copy link
Contributor

bors commented Jan 29, 2016

☔ The latest upstream changes (presumably #31212) made this pull request unmergeable. Please resolve the merge conflicts.

@nikomatsakis
Copy link
Contributor

OK, r=me after a rebase. Just for fun, I kicked off a crater run as well (resolve tends to be finicky).

@jseyfried
Copy link
Contributor Author

rebased

@nikomatsakis
Copy link
Contributor

Crater report shows zero regressions: https://gist.github.com/nikomatsakis/5181cff5cc53438ab82e

@nikomatsakis
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Jan 30, 2016

📌 Commit afd42d2 has been approved by nikomatsakis

@bors
Copy link
Contributor

bors commented Jan 30, 2016

⌛ Testing commit afd42d2 with merge 9ba9f0a...

@bors
Copy link
Contributor

bors commented Jan 30, 2016

💔 Test failed - auto-mac-64-nopt-t

@alexcrichton
Copy link
Member

@bors: retry

On Fri, Jan 29, 2016 at 7:42 PM, bors notifications@github.com wrote:

[image: 💔] Test failed - auto-mac-64-nopt-t
http://buildbot.rust-lang.org/builders/auto-mac-64-nopt-t/builds/7905


Reply to this email directly or view it on GitHub
#30843 (comment).

@bors
Copy link
Contributor

bors commented Jan 30, 2016

⌛ Testing commit afd42d2 with merge 558fd51...

@bors
Copy link
Contributor

bors commented Jan 30, 2016

💔 Test failed - auto-linux-cross-opt

@alexcrichton
Copy link
Member

@bors: retry

On Fri, Jan 29, 2016 at 8:48 PM, bors notifications@github.com wrote:

[image: 💔] Test failed - auto-linux-cross-opt
http://buildbot.rust-lang.org/builders/auto-linux-cross-opt/builds/1063


Reply to this email directly or view it on GitHub
#30843 (comment).

@bors
Copy link
Contributor

bors commented Jan 30, 2016

⌛ Testing commit afd42d2 with merge b16fbe7...

bors added a commit that referenced this pull request Jan 30, 2016
This commit refactors the field `Module::children` from mapping `Name` -> `NameBindings` to mapping `(Name, Namespace)` -> `NameBinding` and refactors the field `Module::import_resolutions` from mapping `Name` -> `ImportResolutionPerNamespace` to mapping `(Name, Namespace)` -> `ImportResolution`.

This allows the duplicate checking code to be refactored so that `NameBinding` no longer needs ref-counting or a RefCell (removing the need for `NsDef`).

r? @nikomatsakis
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.

6 participants