Skip to content

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

Merged
RalfJung merged 1 commit into
rust-lang:masterfrom
Stypox:build-with-features
Jun 19, 2025
Merged

Allow building Miri with --features from miri-script#4396
RalfJung merged 1 commit into
rust-lang:masterfrom
Stypox:build-with-features

Conversation

@Stypox

@Stypox Stypox commented Jun 12, 2025

Copy link
Copy Markdown
Contributor

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.

Comment thread output.tracy Outdated
Comment thread miri-script/src/main.rs Outdated

@RalfJung RalfJung left a comment

Copy link
Copy Markdown
Member

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.

Comment thread miri-script/src/commands.rs Outdated
@Stypox Stypox force-pushed the build-with-features branch from 6eba306 to 967a531 Compare June 13, 2025 21:48

@Stypox Stypox left a comment

Copy link
Copy Markdown
Contributor Author

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.

Comment thread miri-script/src/commands.rs Outdated
@RalfJung

Copy link
Copy Markdown
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
Copy Markdown
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

rustbot commented Jun 19, 2025

Copy link
Copy Markdown
Collaborator

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

Stypox commented Jun 19, 2025

Copy link
Copy Markdown
Contributor Author

@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