Skip to content

rustc_resolve: Move ReducedGraphParent building into its own module #20115

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

Merged
merged 4 commits into from
Dec 31, 2014

Conversation

gereeter
Copy link
Contributor

This also gets rid of a bunch of unnecessary .clones.

cc @eddyb

@rust-highfive
Copy link
Contributor

r? @eddyb

(rust_highfive has picked a reviewer for you, use r? to override)

@gereeter gereeter force-pushed the split-module-building branch from 691f83a to 734a467 Compare December 22, 2014 18:17
@gereeter
Copy link
Contributor Author

I rearranged the commits to make the more controversial free function change last, killed ReducedGraphParent, and added an explaination of my motivation to the free function commit.

@eddyb
Copy link
Member

eddyb commented Dec 22, 2014

I see, but why not remove just the parent field in the visitor and leave the code in methods?
Also, I'd have someone else double-check the clone changes, it's not obvious to me that it's a net improvement.
Otherwise this looks very good to me, thanks a lot!

@nikomatsakis
Copy link
Contributor

So this looks good to me. I don't have a strong opinion about the move to free fns from methods. It is true that self.foo(...) reads better than foo(resolver, ...) -- helps to focus the eye on the relevant arguments. Another possibility would be to use an extension trait on Resolver or, probably better, impl the methods on a newtype'd Resolver like struct GraphBuilder { resolver: Resolver }. The visitor would thus carry around a pointer to that instead of the resolver itself, and it would invoke self.builder.foo() rather than foo(self.resolver, ...).

@nikomatsakis
Copy link
Contributor

Another option might be to just rename the parent field to something less tempting, like most_recently_visited_item

@gereeter gereeter force-pushed the split-module-building branch from 734a467 to c7a8240 Compare December 30, 2014 18:56
@gereeter
Copy link
Contributor Author

Okay, rebased. I now use the idea that @nikomatsakis suggested of having a separate GraphBuilder struct.

P.S. Do you know of any good way to rebase refactors like this? The most effective method I've found is just scrapping everything and starting from the beginning.

bors added a commit that referenced this pull request Dec 30, 2014
This also gets rid of a bunch of unnecessary `.clone`s.

cc @eddyb
alexcrichton added a commit to alexcrichton/rust that referenced this pull request Dec 31, 2014
This also gets rid of a bunch of unnecessary `.clone`s.

cc @eddyb
@bors bors merged commit c7a8240 into rust-lang:master Dec 31, 2014
@gereeter gereeter deleted the split-module-building branch December 17, 2015 01:30
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