From eed864eb36cf28ab2f322f72d43245640e5f6f11 Mon Sep 17 00:00:00 2001 From: Andrea Fioraldi Date: Mon, 10 Jan 2022 10:12:26 +0100 Subject: [PATCH] switch to rustversion --- libafl/Cargo.toml | 2 +- libafl/build.rs | 22 ---------------------- libafl/src/bolts/tuples.rs | 4 ++-- 3 files changed, 3 insertions(+), 25 deletions(-) delete mode 100644 libafl/build.rs diff --git a/libafl/Cargo.toml b/libafl/Cargo.toml index 4be578f646..930383d93a 100644 --- a/libafl/Cargo.toml +++ b/libafl/Cargo.toml @@ -9,7 +9,6 @@ readme = "../README.md" license = "MIT OR Apache-2.0" keywords = ["fuzzing", "testing", "security"] edition = "2021" -build = "build.rs" [features] default = ["std", "derive", "llmp_compression", "rand_trait", "fork"] @@ -43,6 +42,7 @@ num_cpus = "1.0" # cpu count, for llmp example serial_test = "0.5" [dependencies] +rustversion = "1.0" tuple_list = { version = "0.1.3" } hashbrown = { version = "0.11", features = ["serde", "ahash-compile-time-rng"], default-features=false } # A faster hashmap, nostd compatible num-traits = { version = "0.2", default-features = false } diff --git a/libafl/build.rs b/libafl/build.rs deleted file mode 100644 index 98df4b0142..0000000000 --- a/libafl/build.rs +++ /dev/null @@ -1,22 +0,0 @@ -//! special handling to build and link libafl - -use rustc_version::{version_meta, Channel}; - -#[allow(clippy::ptr_arg, clippy::upper_case_acronyms)] -fn main() { - // Set cfg flags depending on release channel - match version_meta().unwrap().channel { - Channel::Stable => { - println!("cargo:rustc-cfg=RUSTC_IS_STABLE"); - } - Channel::Beta => { - println!("cargo:rustc-cfg=RUSTC_IS_BETA"); - } - Channel::Nightly => { - println!("cargo:rustc-cfg=RUSTC_IS_NIGHTLY"); - } - Channel::Dev => { - println!("cargo:rustc-cfg=RUSTC_IS_DEV"); - } - } -} diff --git a/libafl/src/bolts/tuples.rs b/libafl/src/bolts/tuples.rs index 36a327d956..5e78d1ef20 100644 --- a/libafl/src/bolts/tuples.rs +++ b/libafl/src/bolts/tuples.rs @@ -6,7 +6,7 @@ use core::any::TypeId; use xxhash_rust::xxh3::xxh3_64; -#[cfg(feature = "RUSTC_IS_NIGHTLY")] +#[rustversion::nightly] /// From https://stackoverflow.com/a/60138532/7658998 const fn type_eq() -> bool { // Helper trait. `VALUE` is false, except for the specialization of the @@ -28,7 +28,7 @@ const fn type_eq() -> bool { >::VALUE } -#[cfg(not(feature = "RUSTC_IS_NIGHTLY"))] +#[rustversion::not(nightly)] const fn type_eq() -> bool { // BEWARE! This is not unsafe, it is SUPER UNSAFE true