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

Store dependencies as edges of the graph #5428

Merged
merged 1 commit into from
Apr 28, 2018

Conversation

matklad
Copy link
Member

@matklad matklad commented Apr 28, 2018

@alexcrichton
Copy link
Member

@bors: r+

Awesome, thanks!

Much nicer now that it's always Vec<T> which has an "empty" state :)

@bors
Copy link
Contributor

bors commented Apr 28, 2018

📌 Commit 8164be2 has been approved by alexcrichton

@bors
Copy link
Contributor

bors commented Apr 28, 2018

⌛ Testing commit 8164be2 with merge 76d3e1e2e87756071fe726ab6cf8d19773c2e556...

@bors
Copy link
Contributor

bors commented Apr 28, 2018

💔 Test failed - status-travis

@alexcrichton
Copy link
Member

@bors: retry

??

@bors
Copy link
Contributor

bors commented Apr 28, 2018

⌛ Testing commit 8164be2 with merge 72a7e06c290dad6248d4c1ce8a424316256ec7ba...

@bors
Copy link
Contributor

bors commented Apr 28, 2018

💔 Test failed - status-travis

@alexcrichton
Copy link
Member

@bors: retry

@bors
Copy link
Contributor

bors commented Apr 28, 2018

⌛ Testing commit 8164be2 with merge 0e6edcf...

bors added a commit that referenced this pull request Apr 28, 2018
@bors
Copy link
Contributor

bors commented Apr 28, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: alexcrichton
Pushing 0e6edcf to master...

@bors bors merged commit 8164be2 into rust-lang:master Apr 28, 2018
@Eh2406
Copy link
Contributor

Eh2406 commented Apr 30, 2018

I think I am confused by this. What is being stored? Why a Graph<PackageId, Vec<Dependency>> I'd have thought that the data for an edge is A Dependency not a Vec of them?

For some background I was trying to use this to improve the resolver error messages. Currently they are like:

cargo/tests/testsuite/build.rs

Lines 1356 to 1358 in 0b530c3

previously selected package `bad v1.0.0`
... which is depended on by `bar v0.1.0`
... which is depended on by `incompatible_dependencies v0.0.1 ([..])`

But if we had a link to the dependency that caused the relationship it could be improved to: (wording needs improvement)

  previously selected package `bad v1.0.0`
    ... which is depended on by `bar v0.1.0` which requires `bad: "=1.0.0"`
    ... which is depended on by `incompatible_dependencies v0.0.1 ([..])` which requires `bar: "0.1.0"`

@alexcrichton
Copy link
Member

Oh that'd be awesome to include this info in error messages!

I originally though it was gonna be Dependency as well and was surprised myself when it had to be Vec, the tl;dr; is basically:

[dependencies]
foo = "0.1"

[target.foo.dependencies]
foo = "0.1"

[build-dependencies]
foo = "0.1"

# ... etc

@Eh2406
Copy link
Contributor

Eh2406 commented Apr 30, 2018

Ah, so it is a Vec of all the ways that parent depends on child. They should all apply, at least as resolver sees the world, so child must fulfill each of them. Thus the error messages can reasonably use any of them.

@alexcrichton
Copy link
Member

@Eh2406 indeed!

@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