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

Fix build-std collisions. #7860

Merged
merged 2 commits into from
Feb 4, 2020
Merged

Fix build-std collisions. #7860

merged 2 commits into from
Feb 4, 2020

Conversation

ehuss
Copy link
Contributor

@ehuss ehuss commented Feb 3, 2020

build-std unit filenames can collide with user dependencies in some situations. In particular, cc as a build-dependency is likely to be exactly the same as a user's dep. This would result in the cc crate being built twice, but with the same filename, causing a collision.

Other dependencies typically never collide because they have the rustc-dep-of-std feature, but build-dependencies do not.

The solution here is to include is_std in the metadata hash.

Fixes #7859.

@rust-highfive
Copy link

r? @Eh2406

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

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 3, 2020
@ehuss
Copy link
Contributor Author

ehuss commented Feb 3, 2020

I'm reluctant to add the test, since it is somewhat fragile (it makes assumptions about how libstd currently works). I'm fine with removing it (or changing it), but I wanted to get feedback.

Also, per the comment, there is a potential optimization here to set is_std to false for build dependencies. Would it be worthwhile to do that now?

@alexcrichton
Copy link
Member

I agree yeah the test here is probably a bit too brittle to add, I'd be fine landing this without the test. I also think it's fine to be a bit conservative here and build the build dependencies twice. They build pretty quickly anyway and we can always optimize this a bit later if truly necessary (but I highly doubt this'll come up again!)

r=me if you're still ok removing the tests, or r=me if you have changed your mind and would like to keep the test :)

This is too dependent on the particulars of libstd.
@ehuss
Copy link
Contributor Author

ehuss commented Feb 4, 2020

Nah, it's fine, I just removed it.

@bors r=alexcrichton

@bors
Copy link
Contributor

bors commented Feb 4, 2020

📌 Commit acfb89a has been approved by alexcrichton

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 4, 2020
bors added a commit that referenced this pull request Feb 4, 2020
Fix build-std collisions.

`build-std` unit filenames can collide with user dependencies in some situations.  In particular, `cc` as a build-dependency is likely to be exactly the same as a user's dep.  This would result in the `cc` crate being built twice, but with the same filename, causing a collision.

Other dependencies typically never collide because they have the `rustc-dep-of-std` feature, but build-dependencies do not.

The solution here is to include `is_std` in the metadata hash.

Fixes #7859.
@bors
Copy link
Contributor

bors commented Feb 4, 2020

⌛ Testing commit acfb89a with merge acf88cc...

@bors
Copy link
Contributor

bors commented Feb 4, 2020

☀️ Test successful - checks-azure
Approved by: alexcrichton
Pushing acf88cc to master...

@bors bors merged commit acfb89a into rust-lang:master Feb 4, 2020
@ehuss ehuss added this to the 1.43.0 milestone Feb 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Output collision when using build-std and cc as build-dependency
5 participants