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

Make sure to also wrap the initial -vV invocation #13659

Merged
merged 1 commit into from
Apr 15, 2024

Conversation

RalfJung
Copy link
Member

@RalfJung RalfJung commented Mar 27, 2024

Fixes #10885 and therefore helps unblock rust-lang/miri#3422.

This ensures that the version info actually matches the compiler that will later be doing the builds.

@rustbot
Copy link
Collaborator

rustbot commented Mar 27, 2024

r? @weihanglo

rustbot has assigned @weihanglo.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added A-cache-messages Area: caching of compiler messages S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 27, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 27, 2024
DO NOT MERGE: update cargo for experiment

This incorporates rust-lang/cargo#13659 so that we can test it.
@RalfJung
Copy link
Member Author

RalfJung commented Mar 27, 2024

All right now in rust-lang/rust#123124 we have a toolchain with this cargo. CI also still works (including Miri).

So now that's ready for experimentation with sccache. Does someone happen to have a setup ready for this? :D

let status = std::process::Command::new(&args.next().unwrap())
let mut cmd = std::env::args().skip(1).collect::<Vec<_>>();
if cmd.get(1).map(|s| &**s) == Some("-vV") {
// This is the version query, not the target info query, so skip this.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this raises the question, should the env stuff also be set for the -vV query?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, did you mean to add an environment variable similar to RUSTC_VERSION? Is there any benefit to this?

Copy link
Member Author

@RalfJung RalfJung Apr 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is about env vars configured with [env] in config.toml. Should they be set here?

We have a test that they are set for the --print ... invocation. Should they be set for the -vV invocation as well?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, it probably makes sense to also set the env vars. Can you add that? It looks like apply_env_config might need to be pub(crate) or something to make that work.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, done.

@RalfJung
Copy link
Member Author

RalfJung commented Mar 27, 2024

I have installed sccache (apt install sccache), set the env var (export RUSTC_WRAPPER=$(which sccache)), and then tried building a few crates with the toolchain from rust-lang/rust#123124:

rustup-toolchain-install-master -c cargo -- c656380a167bb05da121130f7364bfe5785f1c8b
cargo +c656380a167bb05da121130f7364bfe5785f1c8b build

That seems to work fine. I can see via sccache --show-stats that sccache was invoked. I can see via RUSTC_WRAPPER=/bin/false cargo +c656380a167bb05da121130f7364bfe5785f1c8b build that the -vV call is being wrapped:

error: process didn't exit successfully: `/bin/false /home/r/.rustup/toolchains/c656380a167bb05da121130f7364bfe5785f1c8b/bin/rustc -vV` (exit status: 1)

I have also confirmed that Miri still works, and that setting RUSTC to a non-existent path but using a suitable RUSTC_WRAPPER now makes the test-cargo-miri call succeed (after removing autocfg). So cargo itself seems to be clean then in terms of always applying the wrapper, at least for the code paths needed by that crate.

So... I think we're all good? @ehuss anything else you think should be checked?

(We also still need a decision about applying the env keys though, see above.)

@RalfJung RalfJung marked this pull request as ready for review March 27, 2024 18:58
@weihanglo
Copy link
Member

r? @ehuss

since you seems to involve in the discussion already.

@ehuss
Copy link
Contributor

ehuss commented Apr 10, 2024

Thanks! There looks like there might be a few more things to get this ready to merge:

  • Add an explicit test for this. There are a few ways to go about this, either what is suggested in Make sure to also wrap the initial -vV invocation #10887 (comment), or just have a separate test that has a custom wrapper that checks for the appropriate behavior, or do something similar to the rustc_info_cache test which sets CARGO_LOG=cargo::util::rustc=debug and check for the [..]running [..]my_wrapper rustc -Vv[..] or similar. (That last option might be the easiest if it works.)
  • Update the PR description to remove the "experimentation" description and include an explanation of why the change is being made.
  • Squash the commits.

@RalfJung RalfJung force-pushed the rustc-wrapper branch 3 times, most recently from 6535b01 to c692d8b Compare April 12, 2024 10:03
@RalfJung
Copy link
Member Author

All right, should be all done.

@ehuss
Copy link
Contributor

ehuss commented Apr 15, 2024

Thanks!

@bors r+

@bors
Copy link
Contributor

bors commented Apr 15, 2024

📌 Commit 8a7ba8f has been approved by ehuss

It is now in the queue for this repository.

@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 Apr 15, 2024
@bors
Copy link
Contributor

bors commented Apr 15, 2024

⌛ Testing commit 8a7ba8f with merge 624233b...

@bors
Copy link
Contributor

bors commented Apr 15, 2024

☀️ Test successful - checks-actions
Approved by: ehuss
Pushing 624233b to master...

@bors bors merged commit 624233b into rust-lang:master Apr 15, 2024
21 of 22 checks passed
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 17, 2024
Update cargo

11 commits in 48eca1b164695022295ce466b64b44e4e0228b08..6f06fe908a5ee0f415c187f868ea627e82efe07d
2024-04-12 21:16:36 +0000 to 2024-04-16 18:47:44 +0000
- fix(toml): Error on `[project]` in Edition 2024 (rust-lang/cargo#13747)
- feat(update): Include a Locking message (rust-lang/cargo#13759)
- chore(deps): update rust crate gix to 0.62.0 [security] (rust-lang/cargo#13760)
- test(schemas): Ensure tests cover the correct case (rust-lang/cargo#13761)
- feat(resolve): Tell the user the style of resovle done (rust-lang/cargo#13754)
- Make sure to also wrap the initial `-vV` invocation (rust-lang/cargo#13659)
- docs: update `checkout` GitHub action version (rust-lang/cargo#13757)
- Recategorize cargo test's `--doc` flag under "Target Selection" (rust-lang/cargo#13756)
- Reword sentence describing workspace toml for clarity (rust-lang/cargo#13753)
- docs(ref): Update unstable docs for msrv-policy (rust-lang/cargo#13751)
- refactor(config): Consistently use kebab-case (rust-lang/cargo#13748)

r? ghost
@rustbot rustbot added this to the 1.79.0 milestone Apr 17, 2024
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Apr 17, 2024
Update cargo

11 commits in 48eca1b164695022295ce466b64b44e4e0228b08..6f06fe908a5ee0f415c187f868ea627e82efe07d
2024-04-12 21:16:36 +0000 to 2024-04-16 18:47:44 +0000
- fix(toml): Error on `[project]` in Edition 2024 (rust-lang/cargo#13747)
- feat(update): Include a Locking message (rust-lang/cargo#13759)
- chore(deps): update rust crate gix to 0.62.0 [security] (rust-lang/cargo#13760)
- test(schemas): Ensure tests cover the correct case (rust-lang/cargo#13761)
- feat(resolve): Tell the user the style of resovle done (rust-lang/cargo#13754)
- Make sure to also wrap the initial `-vV` invocation (rust-lang/cargo#13659)
- docs: update `checkout` GitHub action version (rust-lang/cargo#13757)
- Recategorize cargo test's `--doc` flag under "Target Selection" (rust-lang/cargo#13756)
- Reword sentence describing workspace toml for clarity (rust-lang/cargo#13753)
- docs(ref): Update unstable docs for msrv-policy (rust-lang/cargo#13751)
- refactor(config): Consistently use kebab-case (rust-lang/cargo#13748)

r? ghost
@RalfJung RalfJung deleted the rustc-wrapper branch August 6, 2024 11:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-build-execution Area: anything dealing with executing the compiler A-cache-messages Area: caching of compiler messages 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.

RUSTC_WRAPPER is ignored for rustc -vV call
6 participants