cuviper / autocfg

Automatic cfg for Rust compiler features
Apache License 2.0
95 stars 24 forks source link

'probe' does not work under Miri #46

Closed RalfJung closed 2 years ago

RalfJung commented 2 years ago

When autocfg is used in the build script of a cargo miri test invocation, it recently stopped working.

It used to work because the RUSTC env variable was unset, and so autocfg bypassed Miri and queried the rustc binary, which usually is pretty much in sync with the miri binary that actually does all the building and running here, but there is no guarantee of that. It basically used to work by chance.

Since recently (to fix some other issues), RUSTC is now set to the miri binary. And now autocfg does not work any more. I don't quite know what fails yet -- looks like autocfg suppresses all rustc output, so I'll need to work with a patched autocfg to debug any of this (or if you have better ways of debugging autocfg that'd be great to know :). But it might be that the best way to fix this is to make autocfg aware of Miri and adjust its behavior.

RalfJung commented 2 years ago

Ah, turns out we can make this work from the Miri side, so autocfg doesn't need to change anything. :)

cuviper commented 2 years ago

looks like autocfg suppresses all rustc output

FWIW, that's Cargo suppressing all build script output, unless it's -vv double-verbose. But users in #30/#32 want to suppress all output more directly, and I haven't decided how I feel about that... (though you could say inaction is a form of decision too)

RalfJung commented 2 years ago

Yeah I saw that output. :) (though I think I only passed -v, maybe it's because I made the build script fail that it showed the output with less verbosity) It was quite crucial in debugging this. Now autocfg even works when using Miri with a foreign target, thanks to all the TARGET logic you have in place. :D And we have it on CI, so it should not break again.