From 9ed8d5eb65349c4ad81d2cbf354ca8c19e256ee8 Mon Sep 17 00:00:00 2001 From: rmsyn Date: Wed, 30 Aug 2023 04:12:13 +0000 Subject: [PATCH] fixup/ci: feature-gate stabilized compiler features Adds conditional feature-gates based on `rustc` version to only include unstable features on older compiler versions. Introduces the `rustversion` dependency to handle the feature-gates. Fixes breaking CI builds. --- Cargo.toml | 1 + src/lib.rs | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 68e2fef..d318783 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,6 +10,7 @@ categories = ["no-std"] [dependencies] memchr = { version = "2", default-features = false } +rustversion = "1.0" [features] default = ["std"] diff --git a/src/lib.rs b/src/lib.rs index 1016168..080f603 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,8 +1,8 @@ -#![cfg_attr(feature = "nightly", feature(maybe_uninit_ref))] #![cfg_attr(feature = "nightly", feature(never_type))] -#![cfg_attr(all(feature = "std", feature = "nightly"), feature(read_initializer))] #![cfg_attr(not(feature = "std"), no_std)] #![cfg_attr(feature = "std", allow(dead_code))] +#[rustversion::attr(all(before(1.55), nightly), feature(maybe_uninit_ref))] +#[rustversion::attr(all(before(1.55), nightly), feature(read_initializer))] #[cfg(not(feature = "std"))] pub mod error;