-
Notifications
You must be signed in to change notification settings - Fork 384
Passing argument without --
to cargo miri run
*bypasses* miri
#2829
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
Comments
I am confused, probably because I am tired... what is happening here? All these arguments should just be forwarded to |
The issue is that the actual binary gets executed:
And not miri I don't know how a binary even gets created (maybe left over from a previous non-miri run?). |
This is caused by very strange cargo behavior: in With this cargo behavior, I don't know if the bug is fixable. It is not possible for Miri to know whether an argument is present before the We'd have to completely re-parse the arguments and carefully keep that in sync with cargo's parser, which is quite terrible. I would hope the API to be more compositional than that... Cc @ehuss |
When I would suggest structuring the way arguments are forwarded in the following way:
The current structure of forwarding the args before adding cargo-specific flags is the cause of the problem. Let me know if that isn't clear or you have any questions. |
When we passed the arguments in a different order, that broke But anyway the main problem is this:
Here we have to stop at the first argument that is passed to the program. So e.g. |
I personally wouldn't worry too much about having An alternative is to use |
I was living under the illusion that argument parsing worked out in a way that was just modular enough to make this work, but as this issue shows that was just wrong. :( If we are willing to ignore the issues around |
cargo-miri: fix forwarding arguments to cargo Fixes rust-lang/miri#2829
Check this out:
You'd expect
miri run ...
to error on the above code.But:
Now, if someone is reading the above output properly, they might get a hint as to what's actually happening here: it's building and running a debug binary, rather than running cargo-miri itself.
(I.e., you need to pass inputs with an intervening
--
, like so:cargo +nightly miri run -- whoa
, which does what you expect and issues a error at the point whereprintf
is called.)But what is the scenario where you want the current behavior when
--
is omitted? Shouldmiri run
provide an error or warning when--
is omitted and the extra arguments are not recognized by miri's argument processor?The text was updated successfully, but these errors were encountered: