Skip to content

Commit de6ad0b

Browse files
authored
Merge pull request #30 from robinhundt/nightly-cfg
fix(cryprot-core)!: set is_nightly cfg in build.rs
2 parents 254374b + 48bfc69 commit de6ad0b

File tree

5 files changed

+18
-4
lines changed

5 files changed

+18
-4
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cryprot-core/Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ bench = false
1717

1818
[features]
1919
__testing = ["dep:tracing-subscriber"]
20-
nightly = []
2120
num-traits = ["dep:num-traits"]
2221
tokio-rayon = ["dep:rayon", "dep:tokio"]
2322

@@ -48,6 +47,9 @@ libc = { workspace = true }
4847
criterion.workspace = true
4948
proptest = "1.6.0"
5049

50+
[build-dependencies]
51+
rustc_version = "0.4.1"
52+
5153
[[bench]]
5254
harness = false
5355
name = "bench"

cryprot-core/build.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
fn main() {
2+
println!("cargo::rustc-check-cfg=cfg(is_nightly)");
3+
4+
let is_nightly = rustc_version::version_meta()
5+
.map(|meta| meta.channel == rustc_version::Channel::Nightly)
6+
.unwrap_or(false);
7+
8+
if is_nightly {
9+
println!("cargo:rustc-cfg=is_nightly");
10+
}
11+
}

cryprot-core/src/block/gf128.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ mod clmul {
218218
}
219219
}
220220

221-
#[cfg(all(test, feature = "nightly", target_feature = "pclmulqdq"))]
221+
#[cfg(all(is_nightly, test, target_feature = "pclmulqdq"))]
222222
mod benches {
223223
extern crate test;
224224

@@ -439,7 +439,7 @@ mod scalar {
439439
}
440440
}
441441

442-
#[cfg(all(test, feature = "nightly"))]
442+
#[cfg(all(is_nightly, test))]
443443
mod benches {
444444
extern crate test;
445445

cryprot-core/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![cfg_attr(feature = "nightly", feature(test))]
1+
#![cfg_attr(is_nightly, feature(test))]
22
//! Core utilites for cryptographic protocols.
33
//!
44
//! This crate implements several core utilities for cryptographic protocols.

0 commit comments

Comments
 (0)