Skip to content

Commit 7869f61

Browse files
Make the std feature inert (#250)
In more recent versions of Rust the `Error` trait no longer needs to be gated, so use it through `core::error::Error` to remove the only usage of the `feature = "std"` directive. The `std` feature is left for now to avoid breaking downstream users (if any applicable) but should be removable later. --------- Co-authored-by: Chris Fallin <chris@cfallin.org>
1 parent 292ad71 commit 7869f61

File tree

3 files changed

+5
-9
lines changed

3 files changed

+5
-9
lines changed

.github/workflows/rust.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,7 @@ jobs:
5656
- uses: actions/checkout@v3
5757
with:
5858
submodules: true
59-
- run: |
60-
set -e
61-
curl -L https://github.com/EmbarkStudios/cargo-deny/releases/download/0.14.22/cargo-deny-0.14.22-x86_64-unknown-linux-musl.tar.gz | tar xzf -
62-
mv cargo-deny-*-x86_64-unknown-linux-musl/cargo-deny cargo-deny
63-
echo `pwd` >> $GITHUB_PATH
59+
- run: cargo install cargo-deny
6460
- run: cargo deny check
6561

6662
# Builds the fuzz targets.

Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ overflow-checks = true
4040
[features]
4141
default = ["std"]
4242

43-
# Enables std-specific features such as the Error trait for RegAllocError.
43+
# Currently does nothing, but historically enabled some `std` features such as
44+
# the `Error` trait.
4445
std = []
4546

4647
# Enables generation of DefAlloc edits for the checker.

src/lib.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#![allow(clippy::all)]
1515
#![no_std]
1616

17-
#[cfg(feature = "std")]
17+
#[cfg(feature = "fuzzing")]
1818
extern crate std;
1919

2020
extern crate alloc;
@@ -1627,8 +1627,7 @@ impl core::fmt::Display for RegAllocError {
16271627
}
16281628
}
16291629

1630-
#[cfg(feature = "std")]
1631-
impl std::error::Error for RegAllocError {}
1630+
impl core::error::Error for RegAllocError {}
16321631

16331632
/// Run the allocator.
16341633
pub fn run<F: Function>(

0 commit comments

Comments
 (0)