Skip to content

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

Closed

Description

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.requires-nightlyThis issue requires a nightly compiler in some way.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions