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

"error: no such subcommand: +nightly-2022-09-07" when using rustdoc-json on windows #143

Closed
jnises opened this issue Sep 13, 2022 · 4 comments
Labels
bug Something isn't working windows Only affects Microsoft Windows.

Comments

@jnises
Copy link

jnises commented Sep 13, 2022

It seems I'm running into this bug rust-lang/rustup#3036
Nested cargo invocations have issues in recent versions of rustup on windows.

I'm trying to run code like:

rustdoc_json::build(BuildOptions::default().toolchain("+nightly"))

I'm on Windows 11

I can work around the issue by making cargo_rustdoc_command call rustup run nightly-2022-09-07 cargo ... instead of cargo +nightly-2022-09-07 ...

What is the correct way to run nested a cargo with a different toolchain?

@Enselic
Copy link
Owner

Enselic commented Sep 14, 2022

Thanks for reporting!

@Emilgardis Do you see any problem with us using rustup run ... instead?

@jnises Any chance you can create a PR with what works for you? If all our existing regression tests pass after the change, I am comfortable to use the change, because we have a good set of regression tests.

Assuming @Emilgardis does not know of any issues with switching to that. But I do believe that is also what cargo-expand is using, probably for good reason.

@Enselic Enselic added the bug Something isn't working label Sep 14, 2022
@Emilgardis
Copy link
Collaborator

Emilgardis commented Sep 14, 2022

switching to rustup run <toolchain> cargo ... when an override is mentioned sounds good, that's what +toolchain is supposed to be semantically equivalent to

Basically

let mut command = Command::new("cargo");
if let Some(toolchain) = OVERRIDDEN_TOOLCHAIN.or(requested_toolchain.as_deref()) {
command.arg(toolchain);
}
command.arg("rustdoc");

would become

    let mut command = if let Some(toolchain) = OVERRIDDEN_TOOLCHAIN.or(requested_toolchain.as_deref()) {
        Command::new("rustup").args(["run", toolchain, "cargo"])
    } else {
        Command::new("cargo")
    }

    command.arg("rustdoc");    

@Enselic Enselic added the windows Only affects Microsoft Windows. label Sep 15, 2022
@jnises
Copy link
Author

jnises commented Sep 15, 2022

#147 seems to do the same thing as my workaround.
So that should fix my issue :)

@Enselic
Copy link
Owner

Enselic commented Sep 18, 2022

Closed by #147

@Enselic Enselic closed this as completed Sep 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working windows Only affects Microsoft Windows.
Projects
None yet
Development

No branches or pull requests

3 participants