Skip to content

Commit

Permalink
Use rustc_version instead
Browse files Browse the repository at this point in the history
  • Loading branch information
recmo committed May 17, 2022
1 parent 4aae9e4 commit 97ec5b5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 19 deletions.
15 changes: 5 additions & 10 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,9 @@ criterion = { version = "0.3", optional = true }
[build-dependencies]
# Rust currently has no way to conditionally compile based on compiler features.
# `autocfg` is a workaround, but doesn't support probing for `#[features(...)]`
# yet. Luckily a PR adds this support.
autocfg = { version = "1.1", git = "https://github.com/CAD97/autocfg", rev = "a1d7429b90a6a306626d759d8cc6c8558c8f79cd" }
# yet (there's a PR though, but crates.io doesn't allow us to use it).
# So instead, we do the dumb thing and just check for nightly.
rustc_version = "0.4.0"

[dev-dependencies]
proptest = { version = "1.0" }
Expand Down
9 changes: 2 additions & 7 deletions build.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
//! Feature detection for `generic_const_exprs`. This exists mainly to avoid
//! compilation failures when using `--all-features` on stable.
use autocfg::AutoCfg;
use rustc_version::{version_meta, Channel};

fn main() {
let has_generic_const_exprs = AutoCfg::new()
.unwrap()
.probe_features(&["generic_const_exprs"], "");
let has_generic_const_exprs = version_meta().unwrap().channel == Channel::Nightly;
if has_generic_const_exprs {
println!("cargo:rustc-cfg=has_generic_const_exprs");
}
Expand Down

0 comments on commit 97ec5b5

Please sign in to comment.