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

librustc_driver: Make --print file-names do a minor accounting of --emit #68799

Closed
wants to merge 1 commit into from

Conversation

emilio
Copy link
Contributor

@emilio emilio commented Feb 3, 2020

Otherwise we print bogus output which prevents using cargo check with sccache,
see https://bugzilla.mozilla.org/show_bug.cgi?id=1612855#c2 for a reduced
test-case.

Ideally --print file-names will emit only the files emitted by the session, but
that seems a bit hard to do in a general way, so this is a best effort thing
which fixes the cargo check use-case.

…mit.

Otherwise we print bogus output which prevents using `cargo check` with sccache,
see https://bugzilla.mozilla.org/show_bug.cgi?id=1612855#c2 for a reduced
test-case.

Ideally --print file-names will emit all the files emitted by the session, but
that seems a bit hard to do in a general way, so this is a best effort thing
which fixes the cargo check use-case.
@rust-highfive
Copy link
Collaborator

r? @estebank

(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
@emilio
Copy link
Contributor Author

emilio commented Feb 3, 2020

r? @alexcrichton

@emilio
Copy link
Contributor Author

emilio commented Feb 3, 2020

This is somewhat related to #54852 (sccache was working around that already).

emilio added a commit to emilio/sccache that referenced this pull request Feb 3, 2020
This fixes cargo check in mozilla-central. The issue is that rustc --print
file-names emits a somewhat poor approximation of what's actually going to be
emitted.

So for a staticlib crate, it will also print the staticlib file, which is not
great.

See https://bugzilla.mozilla.org/show_bug.cgi?id=1612855#c2 for a more
straight-forward explanation of the failure case.

Sccache would try to find the library and fail, erroring as a consequence.

Pile up on the existing workaround for rmeta files not showing up
(rust-lang/rust#54852) by removing files that are not
metadata when we only request metadata.

rust-lang/rust#68799 contains a rust-side fix that would
also fix this.
froydnj pushed a commit to mozilla/sccache that referenced this pull request Feb 3, 2020
This fixes cargo check in mozilla-central. The issue is that rustc --print
file-names emits a somewhat poor approximation of what's actually going to be
emitted.

So for a staticlib crate, it will also print the staticlib file, which is not
great.

See https://bugzilla.mozilla.org/show_bug.cgi?id=1612855#c2 for a more
straight-forward explanation of the failure case.

Sccache would try to find the library and fail, erroring as a consequence.

Pile up on the existing workaround for rmeta files not showing up
(rust-lang/rust#54852) by removing files that are not
metadata when we only request metadata.

rust-lang/rust#68799 contains a rust-side fix that would
also fix this.
@alexcrichton
Copy link
Member

Thanks for the PR!

It seems a bit odd though to add a helper function for just this one piece of functionality when presumably similar checks are happening elsewhere in the codebase. Is there somewhere else this new function could be used, or if not, is the new function necessary?

@bors
Copy link
Contributor

bors commented Feb 12, 2020

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

@Centril Centril added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 21, 2020
@Centril
Copy link
Contributor

Centril commented Feb 21, 2020

👋 @emilio

@emilio
Copy link
Contributor Author

emilio commented Feb 28, 2020

I'm going to close this because I'm not convince of its correctness. The behavior of --print file-names is quite bizarre.

@emilio emilio closed this Feb 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants