dtolnay/cargo-expand

cargo expand on stable gives "error: no such command: `+nightly`"

blueglyph opened this issue · 2 comments

Description

When I try a Show the result of macro expansion (cargo expand) with the IntelliJ plugin, which executes cargo expand, I get the following error:

cargo.exe expand --test integration --color=always --theme=Dracula --tests path_cases_02::inner
error: no such command: `+nightly`

	Cargo does not handle `+toolchain` directives.
	Did you mean to invoke `cargo` through `rustup` instead?

Process finished with exit code 101

I get the same error when I open a terminal and simply type cargo expand.

Work-around

I tried to switch the default to nightly, and the problem disappeared.

  • from the README.md:

Cargo expand relies on unstable compiler flags so it requires a nightly toolchain to be installed, though does not require nightly to be the default toolchain or the one with which cargo expand itself is executed. If the default toolchain is one other than nightly, running cargo expand will find and use nightly anyway.

  • Even if it has changed and that it now requires nightly to be the default, the error message is very confusing, since it refers to options that are not related to the given parameters.

Environment

  • IntelliJ Rust plugin version: 0.4.189.5234-223
  • Rust toolchain version: 1.68.0 (2c8cc3432 2023-03-06) x86_64-pc-windows-msvc
  • IDE name and version: IntelliJ IDEA 2022.3.3 RC Ultimate Edition (IU-223.8836.35)
  • Operating system: Windows 10 10.0
  • Macro expansion: enabled
  • Additional experimental features: org.rust.macros.proc.attr

Nightly: rustc 1.70.0-nightly (900c35403 2023-03-08)

ehuss commented

Which version of cargo-expand do you have installed? cargo expand --version

I see it's 1.0.27 (I had to switch to nightly again to check that).

I had reinstalled it yesterday so I thought it was the last version. Apparently something went wrong, I've done some clean-up, installed it again and now the problem has disappeared.

I have other issues with strange colours, but that's how IntelliJ is using it by forcing the Dracula theme - actually, it doesn't work if I launch it outside IntelliJ with the same parameters, this is quite strange. But I'll have to see how the plugin works, that's not an issue of this crate.