You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#!/usr/bin/env -S cargo +nightly -Zscript
//! ```cargo//! [dependencies]//! clap = { version = "4.2", features = ["derive"] }//! ```use clap::Parser;#[derive(Parser,Debug)]#[clap(version)]structArgs{#[clap(short, long, help = "Path to config")]config:Option<std::path::PathBuf>,}fnmain(){let args = Args::parse();println!("{:?}", args);}
I expected to see this happen: successful compilation
Instead, this happened:
$ ./test.rs --config file.toml
warning: `package.edition` is unspecified, defaulting to `2024`
Compiling test- v0.0.0 (/Users/alycda/Desktop/RFC-3424)
error[E0432]: unresolved import `clap`
--> test.rs:8:5
|
8 | use clap::Parser;
| ^^^^ use of undeclared crate or module `clap`
error: cannot find attribute `clap` in this scope
--> test.rs:11:3
|
11 | #[clap(version)]
| ^^^^
error: cannot find attribute `clap` in this scope
--> test.rs:13:7
|
13 | #[clap(short, long, help = "Path to config")]
| ^^^^
error[E0599]: no function or associated item named `parse` found for struct `Args` in the current scope
--> test.rs:18:22
|
12 | struct Args {
| ----------- function or associated item `parse` not found for this struct
...
18 | let args = Args::parse();
| ^^^^^ function or associated item not found in `Args`
Some errors have detailed explanations: E0432, E0599.
For more information about an error, try `rustc --explain E0432`.
error: could not compile `test-` (bin "test-") due to 4 previous errors
warning: `package.edition` is unspecified, defaulting to `2024`
Compiling test- v0.0.0 (/Users/davisa/Desktop/untitled folder)
error[E0432]: unresolved import `clap`
--> test.rs:8:5
|
8 | use clap::Parser;
| ^^^^ use of undeclared crate or module `clap`
error: cannot find attribute `clap` in this scope
--> test.rs:11:3
|
11 | #[clap(version)]
| ^^^^
error: cannot find attribute `clap` in this scope
--> test.rs:13:7
|
13 | #[clap(short, long, help = "Path to config")]
| ^^^^
error[E0599]: no function or associated item named `parse` found for struct `Args` in the current scope
--> test.rs:18:22
|
12 | struct Args {
| ----------- function or associated item `parse` not found for this struct
...
18 | let args = Args::parse();
| ^^^^^ function or associated item not found in `Args`
Some errors have detailed explanations: E0432, E0599.
For more information about an error, try `rustc --explain E0432`.
The text was updated successfully, but these errors were encountered:
RE: rust-lang/rfcs#3424
I was following @ChristopherBiscardi 's 2023 Advent of Code and noticed: https://github.com/ChristopherBiscardi/advent-of-code/blob/main/2023/rust/scripts/get-aoc-input.rs . I was following along in the past 2 months on stable rust (<1.81) and since I was not using nightly, I added a Cargo.toml file next to the script. Since the call for testing I have switched to nightly (rustc 1.85.0-nightly (6b6a867ae 2024-11-27)) but I cannot get ANY example to work.
Code
I tried this code:
I expected to see this happen: successful compilation
Instead, this happened:
Version it worked on
It must have worked on nightly ~December 2023, and even as recently as of april 21: https://github.com/hashintel/hash/blob/a4aee712cbc917ab175bdaf6ddff959eea3b31bb/rust-toolchain.toml#L2.
Version with regression
rustc --version --verbose
:Backtrace
Backtrace
The text was updated successfully, but these errors were encountered: