Closed RalfJung closed 2 months ago
Amusingly, MIRI_NO_STD=1 cargo miri run --target i686-unknown-linux-gnu
actually gives a nice error. It is only MIRI_NO_STD=1
with the host target that produces a bad error.
Somehow https://github.com/rust-lang/rust/pull/124582 did not help, this still prints the same bad error. I don't know why things behave different for the host target vs anther target.
Ah, the issue arises when first doing cargo miri run
and then later MIRI_NO_STD=1 cargo miri run
. There's stuff cached in the target
dir that seems to confuse rustc. cargo miri clean
fixes this.
I think that's good enough for now; though if MIRI_NO_STD keeps confusing people maybe we should entirely remove it.
To reproduce, consider the following crate:
with
main.rs
beingIt turns out
panic_semihosting
actually needsstd
on targets that do not satisfyall(target_arch = "arm", target_os = "none")
.When running this with a truly no-std target such as
x86_64-unknown-none
, this is very clear from the error:However, when one does
MIRI_NO_STD=1 cargo miri run
to run this without std on a target that has std, the error is pretty bad:I don't know exactly why that is. But my current inclination is to just remove the MIRI_NO_STD env var; it shouldn't be needd as
-none
targets get built without std automatically...