Skip to content

Conversation

@bjorn3
Copy link
Member

@bjorn3 bjorn3 commented Oct 23, 2025

This allows getting rid of all the argument mangling hacks as well as the exported_non_generic_symbols override hack by doing cargo build instead of cargo check. This is also a prerequisite for using native jit mode support in miri that I hope to add to rustc in the future to be used with cg_clif too.

@rustbot rustbot added the S-waiting-on-author Status: Waiting for the PR author to address review comments label Oct 23, 2025
/// Also disable the MIR pass that inserts an alignment check on every pointer dereference. Miri
/// does that too, and with a better error message.
pub const MIRI_DEFAULT_ARGS: &[&str] = &[
"-Zcodegen-backend=dummy",
Copy link
Member Author

Choose a reason for hiding this comment

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

The dummy codegen backend is a builtin codegen backend that is only capable of emitting rlibs containing the crate metadata. For every other crate type it emits an error after codegen. This is fine for miri as for --crate-type bin, miri exits before codegen.

bors added a commit to rust-lang/rust that referenced this pull request Oct 28, 2025
…apkin

Allow codegen backends to indicate which crate types they support

This way cargo will drop the unsupported crate types for crates that
specify multiple crate types.

This is a prerequisite for rust-lang/miri#4648.
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Oct 28, 2025
…, r=WaffleLapkin

Allow codegen backends to indicate which crate types they support

This way cargo will drop the unsupported crate types for crates that
specify multiple crate types.

This is a prerequisite for rust-lang/miri#4648.
rust-timer added a commit to rust-lang/rust that referenced this pull request Oct 28, 2025
Rollup merge of #148177 - bjorn3:codegen_backend_crate_types, r=WaffleLapkin

Allow codegen backends to indicate which crate types they support

This way cargo will drop the unsupported crate types for crates that
specify multiple crate types.

This is a prerequisite for rust-lang/miri#4648.
@bjorn3 bjorn3 force-pushed the dummy_backend branch 2 times, most recently from ac1e234 to ef6aed4 Compare October 29, 2025 12:23
@rustbot

This comment has been minimized.

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Oct 29, 2025
…es, r=JonathanBrouwer

Handle default features and -Ctarget-features in the dummy backend

This prevents a warning about ABI relevant target features not being set on x86 and arm. In addition it is required for miri to report correct features in is_*_feature_detected!() if miri switches to the dummy backend.

Required for rust-lang/miri#4648
Zalathar added a commit to Zalathar/rust that referenced this pull request Oct 30, 2025
…es, r=JonathanBrouwer

Handle default features and -Ctarget-features in the dummy backend

This prevents a warning about ABI relevant target features not being set on x86 and arm. In addition it is required for miri to report correct features in is_*_feature_detected!() if miri switches to the dummy backend.

Required for rust-lang/miri#4648
jhpratt added a commit to jhpratt/rust that referenced this pull request Oct 30, 2025
…es, r=JonathanBrouwer

Handle default features and -Ctarget-features in the dummy backend

This prevents a warning about ABI relevant target features not being set on x86 and arm. In addition it is required for miri to report correct features in is_*_feature_detected!() if miri switches to the dummy backend.

Required for rust-lang/miri#4648
rust-timer added a commit to rust-lang/rust that referenced this pull request Oct 30, 2025
Rollup merge of #148253 - bjorn3:dummy_backend_target_features, r=JonathanBrouwer

Handle default features and -Ctarget-features in the dummy backend

This prevents a warning about ABI relevant target features not being set on x86 and arm. In addition it is required for miri to report correct features in is_*_feature_detected!() if miri switches to the dummy backend.

Required for rust-lang/miri#4648
@bjorn3 bjorn3 force-pushed the dummy_backend branch 4 times, most recently from a4a79ee to ff9ef3b Compare October 30, 2025 15:00
@bjorn3
Copy link
Member Author

bjorn3 commented Oct 30, 2025

Almost there. With rust-lang/rust#148177 and rust-lang/rust#148253 merged, the entire miri test suite passes after blessing a single change to a query cycle error. Doctests are broken however due to those requiring a check build for bin crates first, which the dummy codegen backend doesn't yet allow. Opened rust-lang/rust#148299 for this.

This allows getting rid of all the argument mangling hacks as well as
the exported_non_generic_symbols override hack by doing cargo build
instead of cargo check. This is also a prerequisite for using native jit
mode support in miri that I hope to add to rustc in the future to be
used with cg_clif too.
@bjorn3
Copy link
Member Author

bjorn3 commented Oct 30, 2025

I hadn't noticed the cargo-miri-test test suite before. It currently has trouble with non-rlib/bin crate types. In particular cargo thinks it needs to build crates only available as cdylib (despite those never being usable) and the dropping unsupported crate type warnings have a non-deterministic order for some reason.

bors added a commit to rust-lang/rust that referenced this pull request Oct 30, 2025
Allow check builds with binaries for the dummy codegen backend

This is likely the last part necessary for rust-lang/miri#4648. Miri needs to be able to do a regular check build for compile_fail doc tests to work.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-author Status: Waiting for the PR author to address review comments

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants