probe_rustc_version can lead to build failures on old nightly rustc
One (I think common) way of using probe_rustc_version is to determine whether a given feature is stable and can be used by the crate. However, as this comment shows, there's a subtle pitfall here: even if we are on version 1.79, that might be an old nightly from the 1.79 cycle which does not yet have the feature!
Would it make sense to have probe_rustc_version ensure that the compiler is at least as new as the given stable release? Basically, this would mean that probe_rustc_version(1, 79) should check
- If we are on beta or stable, require version 1.79
- If we are on nightly, require version 1.80 to be sure that all features from 1.79 are included
I'm wary of changing this given that Rust's cfg(version(...)) is not headed in that direction, even though it did at first.
In general, I think autocfg is better used by probing what you actually want, rather than the version.
given that Rust's cfg(version(...)) is not headed in that direction
That seems like a mistake to me :/