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

the option Z is only accepted on the nightly compiler #113

Closed
Goodjooy opened this issue Jul 19, 2021 · 7 comments
Closed

the option Z is only accepted on the nightly compiler #113

Goodjooy opened this issue Jul 19, 2021 · 7 comments

Comments

@Goodjooy
Copy link

PS D:\RustProject\msg_chain> cargo expand
    Checking msg_chain v0.1.0 (D:\RustProject\msg_chain)
error: the option `Z` is only accepted on the nightly compiler
error: could not compile `msg_chain`
To learn more, run the command again with --verbose.

I am using stable tool chain

installed toolchains
--------------------

stable-x86_64-pc-windows-msvc (default)
nightly-x86_64-pc-windows-msvc

active toolchain
----------------

stable-x86_64-pc-windows-msvc (default)
rustc 1.53.0 (53cb7b09b 2021-06-17)

I think maybe cargo expand failure becuse my crate contain custom derive macro.
And I create a crate named ctest with default code
src/main.rs

fn main() {
    println!("Hello, world!");
}

but cargo expand report the same error

PS D:\RustProject\ctest> cargo expand
    Checking ctest v0.1.0 (D:\RustProject\ctest)
error: the option `Z` is only accepted on the nightly compiler
error: could not compile `ctest`
To learn more, run the command again with --verbose.
@soltzen
Copy link

soltzen commented Jul 29, 2021

Try to run cargo expand --lib, or specify a custom path, like cargo expand --lib -- path::to::function

If that doesn't work out, try running it without cargo-expand: add --verbose to your cargo-expand command and you'll find the cargo rustc command being executed: you can modify it a bit and you'll hit gold

@rozgo
Copy link

rozgo commented Aug 14, 2021

This is the command passed to rustc that seems to be causing the issue:

-Zunpretty=expanded

I did not have nightly installed. After installing, expand worked.

@dtolnay dtolnay changed the title cargo expend but report error: the option Z is only accepted on the nightly compiler the option Z is only accepted on the nightly compiler Sep 2, 2021
@dtolnay
Copy link
Owner

dtolnay commented Sep 2, 2021

Cargo expand requires a reasonably recent nightly compiler installed. As far as I can tell this is working correctly so I'll go ahead and close.

If someone believes they have nightly installed and it is not being found, that needs to be reported to https://github.com/gsquire/toolchain_find.

@dtolnay dtolnay closed this as completed Sep 2, 2021
@jmaargh
Copy link

jmaargh commented Mar 1, 2022

Would be lovely if cargo-expand could check it's at least found a nightly-channel compiler to provide a more informative error message.

@dtgriscom-ta
Copy link

dtgriscom-ta commented Feb 15, 2023

It's close to a year later, and I have the latest standard compiler, and cargo-expand still requires a nightly compiler build. Are there nightly options that will never make it into the standard compiler?

@mimoo
Copy link

mimoo commented Mar 11, 2023

I managed to run it without nightly by doing this:

RUSTC_BOOTSTRAP=1 cargo expand

@qrilka
Copy link

qrilka commented Sep 26, 2023

@dtolnay the recipe above seems to work without nightly, could it be added into the project's README maybe?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants