rustversion icon indicating copy to clipboard operation
rustversion copied to clipboard

rustversion::before(date) matches stable version

Open glandium opened this issue 4 years ago • 1 comments

Building the following:

#[rustversion::before(2020-01-01)]
fn main() {
    println!("Hello, world!");
}

fails as expected with recent nightlies (because of the missing main function in that case) but compiles just fine with 1.51.0.

since() is limited to nightlies. It seems before() should too.

glandium avatar Mar 28 '21 04:03 glandium

I think this is because #[rustversion::before(...) is defined as "Negative of #[rustversion::since(...)].", and #[rustversion::since(<some-nightly-version>)] is defined as "True on that nightly and all newer ones". That would mean that even newer stables than that nightly would not match.

If this is an intentional design decision by @dtolnay, what you want seems to be achieved by #[rustversion::all(nightly, before(2020-01-01))]

wmmc88 avatar Dec 22 '23 00:12 wmmc88