-
Notifications
You must be signed in to change notification settings - Fork 358
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cargo-miri builds proc-macro crate's unit tests as an executable and tries to interpret it as JSON #1660
Comments
Interesting, yet another corner case for the collection. Looks like our heuristics in cargo-miri need some more tweaking. Thanks for the minimal testcase! |
Just noticed that this issue disappeared when I passed |
What happens when you pass |
It's same: |
Note that I noticed the unit tests were still built as an executable and was run by the operating system instead of Miri. |
It seems that this is caused by Cargo built these tests for the host target (without cargo-miri could |
That sounds like a bug -- build scripts and proc macros are not executed using a And then there's this other point...
I tend to agree; the expectation with OTOH, for things like So maybe what we should do is something like
Do you think that would make sense? |
It would be possible if Cargo builds them for the target.
That sounds reasonable. Detecting the tests and building them (and their dependencies) for the interpreter seems tricky though, as that's not what Cargo does by default. |
Yeah. But it doesn't and it would make little sense for Miri to diverge from that I think. I wonder if people even expect proc-macro unit tests to be run in Miri, given that proc-macros themselves are not run in Miri? Maybe as a first step we should just skip these tests entirely with an appropriate message (similar to what we currently do for doctests). Is that possible without |
The easiest way to do this is to make the "outdated or invalid JSON" error non-fatal, but I think that's undesirable. I'll think some more. |
Right, that's one stage after the mistake happened... there is a prior Btw, speaking of the log... note that cargo will cache the rustc output. So when you change verbosity, you have to |
I remember that I tried to detect it by searching for |
Yes, that sounds reasonable. We have to generate something in Should it be an error or a warning though? Is there a way to tell |
AFAIK no (but I'm not super familiar with Cargo), so it should be a warning (or at least a non-fatal error). |
I tried this with today's nightly:
And it reported an error:
But
cargo_miri_bug-90df6bde175539f3
is not JSON at all:It's an executable. I can even run it manually.
Actually I think, for unit tests, cargo-miri should build the entire
proc-macro
crate and use Miri to interpret it like normal crates, not building an executable with machine code. (That is,cargo_miri_bug-90df6bde175539f3
should be a JSON file, but it's currently not.)The text was updated successfully, but these errors were encountered: