Skip to content

Allow building Miri with --features from miri-script #4396

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

Merged
merged 1 commit into from
Jun 19, 2025

Conversation

Stypox
Copy link
Contributor

@Stypox Stypox commented Jun 12, 2025

I added the --features flag to all Commands for which cargo can accept --features, i.e. install, build, check, test, run, doc. Those who can't accept --features are clippy, fmt, toolchain, rustc pull, rustc push, squash (the last 4 are not even cargo commands). Furthermore, I did not add it to the Bench command since that command doesn't take any "--flags" either.

This PR is needed because there is no way to pass e.g. --features tracing just to the cargo commands issued on the root repository. Unfortunately CARGO_EXTRA_FLAGS applies the flags to the "cargo-miri" crate, too, which does not make sense for crate-specific features.

This PR also includes a small commit to make the interface of install_to_sysroot clearer.

Note: this PR is the counterpart to rust-lang/rust#142379, which is for when Miri is built in the rustc repo.

Copy link
Member

@RalfJung RalfJung left a comment

Choose a reason for hiding this comment

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

Thanks! Overall, I am on board. I left some comments.

I'd prefer if we didn't have to pass this around everywhere, it seems easy to mix up the feature lists. But that seems like a larger refactor... so not for this PR.

@Stypox Stypox force-pushed the build-with-features branch from 6eba306 to 967a531 Compare June 13, 2025 21:48
Copy link
Contributor Author

@Stypox Stypox left a comment

Choose a reason for hiding this comment

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

Thanks for the review! I force pushed to remove the unrelated file (I made the commit a few weeks ago and cherry picked it a few times, and that file was committed accidentally at some point, sorry for not noticing). I also pushed a commit to add --features to clippy and to auto_actions and to fix the order of features and flags.

@RalfJung
Copy link
Member

I assume this is
@rustbot ready
?

@rustbot rustbot added the S-waiting-on-review Status: Waiting for a review to complete label Jun 19, 2025
@RalfJung
Copy link
Member

This looks great, thanks! Please squash the commits using ./miri squash. Then write @rustbot ready after you force-pushed the squashed PR.

@rustbot author

@rustbot rustbot removed the S-waiting-on-review Status: Waiting for a review to complete label Jun 19, 2025
@rustbot
Copy link
Collaborator

rustbot commented Jun 19, 2025

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@rustbot rustbot added the S-waiting-on-author Status: Waiting for the PR author to address review comments label Jun 19, 2025
Otherwise there was no way to pass e.g. `--features tracing` just to the `cargo` commands issued on the root repository:
CARGO_EXTRA_FLAGS applies the flags to the "cargo-miri" crate, too, which does not make sense for crate-specific features.

Fix install_to_sysroot doing path concatenation twice. Since the second concatenation was against an absolute path, it didn't do anything. This also makes the interface of install_to_sysroot() similar to that of cargo_cmd().

Implement --features for clippy, also fix not passing features to one of the cargo invocations for test
@Stypox Stypox force-pushed the build-with-features branch from c7d7514 to eb56874 Compare June 19, 2025 08:08
@Stypox
Copy link
Contributor Author

Stypox commented Jun 19, 2025

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Waiting for a review to complete and removed S-waiting-on-author Status: Waiting for the PR author to address review comments labels Jun 19, 2025
@RalfJung RalfJung added this pull request to the merge queue Jun 19, 2025
Merged via the queue into rust-lang:master with commit 2f4f9ac Jun 19, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Waiting for a review to complete
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants