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

Split resolver module to make it more manageable #5258

Merged
merged 5 commits into from
Mar 30, 2018

Conversation

djc
Copy link
Contributor

@djc djc commented Mar 29, 2018

The core::resolver module is currently the largest in Cargo, at some 2000 lines. Here's an attempt at splitting it into more reasonable parts and reordering the code in it for better comprehensibility.

Splitting is done in three major steps:

  • Move the Resolve type and its dependencies into a separate module (~220 lines)
  • Move utility data types into a separate module (~400 lines)
  • Move the Context type and its dependencies into a separate module (~400 lines)

This halves the size of the root module, which is then reordered to make it more readable.

(This is a yak-shaving expedition of sorts, in preparation for #1286.)

@alexcrichton
Copy link
Member

r? @Eh2406

@bors: delegate=Eh2406

@bors
Copy link
Collaborator

bors commented Mar 29, 2018

✌️ @Eh2406 can now approve this pull request

@Eh2406
Copy link
Contributor

Eh2406 commented Mar 29, 2018

I love the Iday! Thank you for doing this. Is there anything in particular I should look out for in reviewing?

@alexcrichton
Copy link
Member

Ah no worries, I figured you'd like to at least look it over!

@bors: r+

Thanks @djc!

@bors
Copy link
Collaborator

bors commented Mar 29, 2018

📌 Commit 7b9050d has been approved by alexcrichton

@bors
Copy link
Collaborator

bors commented Mar 29, 2018

⌛ Testing commit 7b9050d027026e5de1540e33fbfcad1f0b1ae0a2 with merge c8551e0ff2ce275ef00d9b80c15ecf8bcfb577b5...

@bors
Copy link
Collaborator

bors commented Mar 29, 2018

💔 Test failed - status-travis

@Eh2406
Copy link
Contributor

Eh2406 commented Mar 29, 2018

Looked it over, assuming that the copy/paste s did not hide changes then this looks good.
I think of Activations as being a detail of Context but that is just my opinion.
Also this needs a cargo fmt to pass CI.

@djc
Copy link
Contributor Author

djc commented Mar 29, 2018

@Eh2406 yeah, this just moves code around.

I pushed #5261 to deal with the (unrelated) formatting issues. In the push I did just now, I also moved Activations into resolver::context, that seems to work out nicely (slightly fewer imports).

@Eh2406
Copy link
Contributor

Eh2406 commented Mar 29, 2018

I will approve when CI is green. Thanks for doing this!

@djc
Copy link
Contributor Author

djc commented Mar 29, 2018

(Note that Travis won't go green for the fmt job, but after merging things should be good.)

@Eh2406
Copy link
Contributor

Eh2406 commented Mar 29, 2018

Ya, just figured that out.
@bors: r+

@bors
Copy link
Collaborator

bors commented Mar 29, 2018

📌 Commit d0bedf0 has been approved by Eh2406

@bors
Copy link
Collaborator

bors commented Mar 29, 2018

💡 This pull request was already approved, no need to approve it again.

@bors
Copy link
Collaborator

bors commented Mar 29, 2018

📌 Commit d0bedf0 has been approved by Eh2406

@bors
Copy link
Collaborator

bors commented Mar 29, 2018

⌛ Testing commit d0bedf0 with merge be67876921be5956455be24d6f723e83918cc313...

@bors
Copy link
Collaborator

bors commented Mar 29, 2018

💔 Test failed - status-travis

@Eh2406
Copy link
Contributor

Eh2406 commented Mar 29, 2018

Do you want to try a manual merge or a rebase?

@djc
Copy link
Contributor Author

djc commented Mar 29, 2018

@Eh2406 I'm completely confused now. #5261 hasn't landed on master yet... I guess it got canceled because I removed my branch, or something? I suppose this PR will have to wait until that is landed.

@Eh2406
Copy link
Contributor

Eh2406 commented Mar 29, 2018

opps, ya that can happen. If you dell the branch while bors is testing then you cancel the merge.

@djc
Copy link
Contributor Author

djc commented Mar 29, 2018

Once #5261 is finally merged, I'll rebase this on top of master again.

bors added a commit that referenced this pull request Mar 29, 2018
Fix formatting issues with cargo fmt

Noticed these unrelated formatting problems while working on #5258.
@Eh2406
Copy link
Contributor

Eh2406 commented Mar 29, 2018

@bors r+

@bors
Copy link
Collaborator

bors commented Mar 29, 2018

💡 This pull request was already approved, no need to approve it again.

  • This pull request previously failed. You should add more commits to fix the bug, or use retry to trigger a build again.

@bors
Copy link
Collaborator

bors commented Mar 29, 2018

📌 Commit d0bedf0 has been approved by Eh2406

@bors
Copy link
Collaborator

bors commented Mar 29, 2018

⌛ Testing commit d0bedf0 with merge 97e8afe...

bors added a commit that referenced this pull request Mar 29, 2018
Split resolver module to make it more manageable

The `core::resolver` module is currently the largest in Cargo, at some 2000 lines. Here's an attempt at splitting it into more reasonable parts and reordering the code in it for better comprehensibility.

Splitting is done in three major steps:

* Move the `Resolve` type and its dependencies into a separate module (~220 lines)
* Move utility data types into a separate module (~400 lines)
* Move the `Context` type and its dependencies into a separate module (~400 lines)

This halves the size of the root module, which is then reordered to make it more readable.

(This is a yak-shaving expedition of sorts, in preparation for #1286.)
@Eh2406
Copy link
Contributor

Eh2406 commented Mar 30, 2018

One more time:
@bors r+

@bors
Copy link
Collaborator

bors commented Mar 30, 2018

📌 Commit 45da574 has been approved by Eh2406

@bors
Copy link
Collaborator

bors commented Mar 30, 2018

⌛ Testing commit 45da574 with merge 3548057...

bors added a commit that referenced this pull request Mar 30, 2018
Split resolver module to make it more manageable

The `core::resolver` module is currently the largest in Cargo, at some 2000 lines. Here's an attempt at splitting it into more reasonable parts and reordering the code in it for better comprehensibility.

Splitting is done in three major steps:

* Move the `Resolve` type and its dependencies into a separate module (~220 lines)
* Move utility data types into a separate module (~400 lines)
* Move the `Context` type and its dependencies into a separate module (~400 lines)

This halves the size of the root module, which is then reordered to make it more readable.

(This is a yak-shaving expedition of sorts, in preparation for #1286.)
@bors
Copy link
Collaborator

bors commented Mar 30, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: Eh2406
Pushing 3548057 to master...

@bors bors merged commit 45da574 into rust-lang:master Mar 30, 2018
@djc djc deleted the split-resolver branch March 30, 2018 11:36
bors added a commit that referenced this pull request Apr 4, 2018
Introduce FeatureValue type to represent features table values

This is the next step towards #1286 (after #5258). The goal here is to have a central place in the code where feature strings are interpreted as (a) a feature, (b) a dependency or (c) a dependency/feature combo, and anchor that interpretation in the type system as an enum.

I've spent quite a bit of effort avoiding extra string allocations, complicating the code a bit; notice in particular the use of `Cow<str>` in `FeatureValue` variants, and the slight workaround in `Context::resolve_features()` and `build_requirements()`. I hope this is all okay.

cc @Eh2406
@ehuss ehuss added this to the 1.27.0 milestone Feb 6, 2022
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.

5 participants