-
Notifications
You must be signed in to change notification settings - Fork 432
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
Fix build error with i128_support
on Rust 1.26
#459
Conversation
Interesting; hadn't thought about solving this issue this way. The main concern I have is that there is no guarantee that either |
That makes sense. I think this can be worked out as extern crate version_check;
use std::io::{self, Write};
fn main() {
match version_check::is_min_version("1.26.0") {
Some((true, _version)) => {
println!("cargo:rustc-cfg=stable_i128");
},
Some(_) => (),
None => {
// Not `eprintln!` because it is only available from Rust 1.19.
writeln!(io::stdout(), "couldn't query version info from rustc").unwrap();
},
}
} |
I just found out that this same fix can be backported to |
I don't see much need to update 0.3 (are there still any users?) but it would be good to apply this to master as well (since we still compilers back to 1.22). |
On master this should already work with the latest stable, but only with the I have a few things I am not sure about:
|
I checked the dependency and it is quite small, though as you say still an extra dependency. Eventually the dependency will go away anyway (once we update the minimum supported version). The disadvantage of making it opt-in is that we need to support the |
Yes, as soon as 1.26 is the minimum version this will solve itself. In a way I like being able to depend on the Rust version, but want to make sure we don't do it casually.
I am not sure what you mean. Invalid/unrecognized features are just ignored. |
Are they?
So we need to keep old features in the Cargo.toml, though don't need to do anything in code. |
So nothing to do for master then. Do we want to make a new 0.4 release for this? I don't see much point since should have 0.5 out very soon and this is only to enable 128-bit types on stable compilers, though it's not a big deal if we must. |
I'm going to close this then. Master (soon to be 0.5) already supports #![cfg_attr(all(feature="i128_support", feature="nightly"), allow(stable_features))] // stable since 2018-03-27
#![cfg_attr(all(feature="i128_support", feature="nightly"), feature(i128_type, i128))] |
This PR leaves i128 support opt-in -- I don't know if it should be automatically enabled for Rust 1.26+.
Also let me know if you prefer to manually parse output from
rustc --version
to keeprand
with fewer dependencies.Fixes #458.