Skip to content

Commit

Permalink
fixup/ci: feature-gate stabilized compiler features
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
rmsyn committed Aug 30, 2023
1 parent 545e84b commit 9ed8d5e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ categories = ["no-std"]

[dependencies]
memchr = { version = "2", default-features = false }
rustversion = "1.0"

[features]
default = ["std"]
Expand Down
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down

0 comments on commit 9ed8d5e

Please sign in to comment.