-
Notifications
You must be signed in to change notification settings - Fork 353
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 test
is broken for doctests (Option 'sysroot' given more than once)
#3404
Comments
cargo miri test
is broken for doctestscargo miri test
is broken for doctests (Option 'sysroot' given more than once)
That arg file contains
So... these arguments actually are all already patched properly as we are patching the The only actual issue is that Miri needs to run the rustc driver with a different default sysroot, and there's currently no way to do that other than patching command-line arguments. And annoyingly rustc bails when there are multiple Ideally rustc_driver would just let us set a default sysroot so we don't need these command-line parsing hacks. (Well we still need them in cargo-miri but at least not in the miri driver. So in the future arg files may still cause more issues.) |
It seems like rust-lang/rust#122993 may help though (hard to test since I haven't yet managed to run cargo-miri with doctests inside the rustc sysroot). But there could still be various other things going wrong in cargo-miri as it relies quite a bit on being able to scan the command-line arguments passed to rustc... Does cargo itself ever use arg files? |
For anyone looking for a workaround: use |
Looking at what cargo-miri does here, even if rust-lang/rust#122993 resolves the
Will rustdoc ever pass any of these in an arg file? Probably Miri should "just" implement arg file handling, but not sure when we'll get around to doing that. |
give rustc_driver users a chance to overwrite the default sysroot and then use that in Miri. This lets us get rid of an annoying arg-patching hack, and may help with rust-lang/miri#3404. Unfortunately the computation of `real_rust_source_base_dir` depended on knowing the default sysroot, so I had to move that around a bit. I have no idea how all this `Session` and `Options` stuff works so I hope this makes sense.
Rustup, fix rustdoc sysroot issue This uses a different approach to resolve #3404: we entirely move the responsibility of setting miri-sysroot to whatever *invokes* the Miri driver. cargo-miri knows whether it is inside rustdoc or not and can adjust accordingly. I previously avoided doing that because there are a bunch of places that are invoking the driver (cargo-miri, the ui test suite, `./miri run`, `./x.py run miri`) and they all need to be adjusted now. But it is also somewhat less fragile as we usually have more information there -- and we can just decide that `./miri run file.rs --sysroot path` is not supported.
So anything to change in rustdoc for this to work? I can move |
I think I found a solution in #3409. But yes moving Looking at your PR, I think the only one that could still be an issue is |
You can use |
Okay #3409 is hitting some issues that I can't investigate right now. @GuillaumeGomez if you could move |
Doing it right away. 👍 |
Damn, I am locally still seeing the error after updating... |
Ah, it's harmless... previously rustdoc used |
Okay that worked, thanks to @GuillaumeGomez for the help. :) |
Glad it was fixed for you. :) |
rust-lang/rust#122840 changed the way rustdoc passes arguments to rustc for doctest builds, which causes
cargo miri test
to break. The first symptom is output likeThe deeper cause is that Miri does a lot of scanning and patching of rustc command-line arguments, and if those arguments are hidden in a file then everything breaks.
The text was updated successfully, but these errors were encountered: