Skip to content

Can't set -Znext-solver=globally for proc macros under Miri #5101

Description

@nazar-pc

The crate I'm trying to test under Miri has a proc macro that depends on a crate that requires -Znext-solver=globally.

As of nightly-2026-06-23 the behavior is the following when compiling without --target (https://github.com/nazar-pc/miri-5101-reproduction):

nazar-pc@nazar-pc:/w/g/miri-5101-reproduction> RUSTFLAGS="-Znext-solver=globally" MIRIFLAGS="-Znext-solver=globally" cargo miri test -Ztarget-applies-to-host -Zhost-config --config 'host.rustflags=["-Znext-solver=globally"]' --bins --lib --tests
warning: unit tests of `proc-macro` crates are executed outside Miri
    Finished `test` profile [unoptimized + debuginfo] target(s) in 0.01s
     Running unittests src/main.rs (/home/nazar-pc/.cache/cargo/target/miri/x86_64-unknown-linux-gnu/debug/deps/repro_app-97ab5c3cd2d7783c)

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.03s

     Running unittests src/lib.rs (/home/nazar-pc/.cache/cargo/target/miri/debug/deps/repro_proc_macro-c89753020fd7ddbf)
fatal error: file "/home/nazar-pc/.cache/cargo/target/miri/debug/deps/repro_proc_macro-c89753020fd7ddbf" contains outdated or invalid JSON; try `cargo clean`
error: test failed, to rerun pass `-p repro-proc-macro --lib`

Caused by:
  process didn't exit successfully: `/home/nazar-pc/.cache/rustup/toolchains/nightly-2026-06-23-x86_64-unknown-linux-gnu/bin/cargo-miri runner /home/nazar-pc/.cache/cargo/target/miri/debug/deps/repro_proc_macro-c89753020fd7ddbf` (exit status: 1)
note: test exited abnormally; to see the full output pass --no-capture to the harness.

There is no error when another --target is used though:

nazar-pc@nazar-pc:/w/g/miri-5101-reproduction> RUSTFLAGS="-Znext-solver=globally" MIRIFLAGS="-Znext-solver=globally" cargo miri test -Ztarget-applies-to-host -Zhost-config --config 'host.rustflags=["-Znext-solver=globally"]' --bins --lib --tests -Zjson-target-spec --target riscv64a23-unknown-linux-gnu
warning: unit tests of `proc-macro` crates are executed outside Miri
    Finished `test` profile [unoptimized + debuginfo] target(s) in 0.00s
     Running unittests src/main.rs (/home/nazar-pc/.cache/cargo/target/miri/riscv64a23-unknown-linux-gnu/debug/deps/repro_app-5a28d6724806c826)

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.03s

     Running unittests src/lib.rs (/home/nazar-pc/.cache/cargo/target/miri/debug/deps/repro_proc_macro-c89753020fd7ddbf)

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

     Running unittests src/lib.rs (/home/nazar-pc/.cache/cargo/target/miri/riscv64a23-unknown-linux-gnu/debug/deps/repro_proc_macro_dep-11c9dc78b4c984c2)

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.03s

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-cargoArea: affects the cargo wrapper (cargo miri)C-supportCategory: Not necessarily a bug, but someone asking for support

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions