dtolnay/cargo-expand

Maybe: work around rustup#3036

CAD97 opened this issue · 3 comments

CAD97 commented

context: rust-lang/rustup#3036 rust-lang/rustup#3035

As of rustup 1.25, cargo-expand doesn't work when run from stable:

〉main:pegcel〉$env.CARGO
Error: nu::shell::name_not_found (link)

  × Name not found
   ╭─[entry #27:1:1]
 1$env.CARGO
   ·      ──┬──
   ·        ╰── did you mean 'Path'?
   ╰────

〉main:pegcel〉rustup -vV
rustup 1.25.1 (bb60b1e89 2022-07-12)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active `rustc` version is `rustc 1.62.1 (e092d0b6b 2022-07-16)`
〉main:pegcel〉cargo +nightly expand --version
cargo-expand 1.0.27
〉main:pegcel〉cargo expand --example item
error: no such subcommand: `+nightly`
〉main:pegcel〉

AIUI 1.25.1 reverted (perhaps temporarily?) the change to set $RUSTC so that cargo +toolchain could function when run from a cargo invocation. However, there's a separate change that also impacts Windows that leads to the toolchain cargo being selected instead of the rustup shim.

I'm honestly not exactly certain what the correct behavior w.r.t. rust-lang/rustup#3036 is. Perhaps the correct option is to use rustup run nightly cargo instead of cargo +nightly?

Would you be able to confirm whether #160 fixes this? I don't have access to Windows.

cargo install --git https://github.com/dtolnay/cargo-expand --branch rustuprun --force
CAD97 commented

I can confirm that #160 fixes this 🎉

Thanks, great. Published in 1.0.28.