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

since and before for stable versions do not consider the date of nightly build #42

Open
wmmc88 opened this issue Dec 23, 2023 · 0 comments

Comments

@wmmc88
Copy link

wmmc88 commented Dec 23, 2023

According to the README, #[rustversion::since(1.74)] should be

True on that stable release and any later compiler, including beta and nightly.

The key word in this sentence is later. Stable Rust 1.74.0 was released on 2023-11-16, but nightly-2023-09-14 is a nightly that came out more than 2 months before. The following snippet succeeds to compile when it should fail because the nightly is older than 1.74:

#[rustversion::since(1.74)]
fn main() {
   println!("Hello, world!");
}
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)
    Finished dev [unoptimized + debuginfo] target(s) in 2.26s

Similarly, the below snippet fails to compile on nightly-2023-09-14:

#[rustversion::before(1.74)]
fn main() {
    println!("Hello, world!");
}
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)
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
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