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

Matching wrong nightly versions by 1 day #41

Open
wmmc88 opened this issue Dec 22, 2023 · 1 comment
Open

Matching wrong nightly versions by 1 day #41

wmmc88 opened this issue Dec 22, 2023 · 1 comment

Comments

@wmmc88
Copy link

wmmc88 commented Dec 22, 2023

version: rustversion = "1.0.14"

#[rustversion::nightly(2023-09-13)]
fn main() {
    println!("Hello, world!");
}

With nightly-2023-09-13:

cargo +nightly-2023-09-13 b
   Compiling rustversion v1.0.14
   Compiling rust-version-test v0.1.0 (D:\git-repos\github\rust-version-test)
error[E0601]: `main` function not found in crate `rust_version_test`
 --> src\main.rs:4:2
  |
4 | }
  |  ^ consider adding a `main` function to `src\main.rs`

For more information about this error, try `rustc --explain E0601`.
error: could not compile `rust-version-test` (bin "rust-version-test") due to previous error

With nightly-2023-09-14:

 cargo +nightly-2023-09-14 b
   Compiling rustversion v1.0.14
   Compiling rust-version-test v0.1.0 (D:\git-repos\github\rust-version-test)
    Finished dev [unoptimized + debuginfo] target(s) in 1.86s

As you can see, it fails to compile on nightly-2023-09-13, but succeeds on nightly-2023-09-14. I would expect the opposite behaviour to be true. It seems like the nightly version name is off by 1 compared to what rustversion thinks it is. I'm not sure if this is a bug in rustversion or in how the rust releases tag their names.

@wmmc88
Copy link
Author

wmmc88 commented Jan 19, 2024

I think the date used in the rustversion macro corresponds with the date of the latest commit in that particular nightly build, and not the name of the nightly which matches the archive date. I think this should probably be called out in the documentation for this crate.

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

1 participant