Skip to content
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

rustdoc: unstable --test-builder option is parsed incorrectly ("too many file operands") #80893

Closed
teryror opened this issue Jan 10, 2021 · 1 comment
Labels
C-bug Category: This is a bug. requires-nightly This issue requires a nightly compiler in some way. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@teryror
Copy link
Contributor

teryror commented Jan 10, 2021

Preliminary experimentation with making Miri run doc-tests leads me to believe this is a bug. I tried invoking this command:

rustdoc --crate-type lib --test /home/tld/Documents/coca/src/lib.rs --crate-name coca
-L dependency=/home/tld/Documents/coca/target/x86_64-unknown-linux-gnu/debug/deps
-L dependency=/home/tld/Documents/coca/target/debug/deps --cfg feature=\"default\"
--extern coca=/home/tld/Documents/coca/target/x86_64-unknown-linux-gnu/debug/deps/libcoca-8671386d903c290f.rlib
--extern rand=/home/tld/Documents/coca/target/x86_64-unknown-linux-gnu/debug/deps/librand-af6e186424c4447e.rlib
-C embed-bitcode=no
--sysroot /home/tld/.cache/miri/HOST
-Z unstable-options --test-builder /home/tld/.cargo/bin/cargo-miri

Most of these arguments are provided by cargo and just being passed through cargo-miri, I only append the --sysroot PATH --test-builder PATH part at the end. With or without the --sysroot option, I get error: too many file operands. I don't get that error when omitting the final path to cargo-miri (i.e. using --test-builder as a flag without any arguments).

That error originates here, but after a bit of digging through librustdoc, I believe this:

rust/src/librustdoc/lib.rs

Lines 414 to 420 in 9775ffe

unstable("test-builder", |o| {
o.optflag(
"",
"test-builder",
"specified the rustc-like binary to use as the test builder",
)
}),

...should really call optopt instead of optflag.

I don't really know this codebase or even the getopts library, so I might be off base here. I don't have a build environment set up to test my hypothesis though, so I was hoping someone more familiar could do a quick sanity check for me, or even fix the issue by the time I could try this "quick" change myself. (I won't have time to set up the build environment until tomorrow afternoon, at the earliest...)

I suppose I could also just be grossly misunderstanding how this option is supposed to work, in which case it'd be great if someone could enlighten me.

@jonas-schievink jonas-schievink added the T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. label Jan 11, 2021
@jyn514 jyn514 added C-bug Category: This is a bug. requires-nightly This issue requires a nightly compiler in some way. labels Jan 12, 2021
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue Jan 13, 2021
Fix rustdoc --test-builder argument parsing

My suggested fix to issue rust-lang#80893. I can actually hook Miri in there now.

I also fixed what I believe to be a typo in the option's help text.
@teryror
Copy link
Contributor Author

teryror commented Jan 13, 2021

Fixed by PR #80924.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. requires-nightly This issue requires a nightly compiler in some way. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants