Skip to content

Commit

Permalink
Drop "nightly" feature in favor of stabilized core::error::Error for …
Browse files Browse the repository at this point in the history
…ParseError when building for no_std

The nightly error_in_core feature was stabilized in rust version 1.81.0, so we
can now remove the use of our custom "nightly" feature as a crutch to signal
its availability. We instead use it unconditionally when std feature is unavailable
and bump the crate's MSRV to 1.81.0.

Note that this could be an undesireable MSRV bump for folks consuming this crate,
particularly for those who aren't building without std. As such, I'm keeping
this on the 0.8.0-dev branch only and not adding this to the 0.7 branch.
  • Loading branch information
cole14 committed Feb 12, 2025
1 parent ebfd5e0 commit 9deda06
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Install MSRV
run: rustup update 1.62.1 && rustup default 1.62.1
run: rustup update 1.81.0 && rustup default 1.81.0
- name: Test
run: cargo test --verbose
- name: Build no_std
Expand Down
4 changes: 1 addition & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ categories = ["no-std", "os", "embedded"]
exclude = [".gitignore", "/.github", "/sample-objects"]
readme = "README.md"
edition = "2021"
rust-version = "1.62.1"
rust-version = "1.81.0"

[lib]
name = "elf"
Expand All @@ -23,5 +23,3 @@ default = ["alloc" , "std", "to_str"]
alloc = []
std = ["alloc"]
to_str = []
# Enable for nightly feature(error_in_core) to impl core::error::Error on ParseError
nightly = []
1 change: 0 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@
//! ```
#![cfg_attr(not(feature = "std"), no_std)]
#![cfg_attr(all(feature = "nightly", not(feature = "std")), feature(error_in_core))]
#![warn(rust_2018_idioms)]
#![deny(missing_debug_implementations)]
#![forbid(unsafe_code)]
Expand Down
2 changes: 1 addition & 1 deletion src/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ impl std::error::Error for ParseError {
}
}

#[cfg(all(feature = "nightly", not(feature = "std")))]
#[cfg(not(feature = "std"))]
impl core::error::Error for ParseError {
fn source(&self) -> Option<&(dyn core::error::Error + 'static)> {
match *self {
Expand Down

0 comments on commit 9deda06

Please sign in to comment.