Skip to content

Commit

Permalink
multiboot2-header: add unstable feature
Browse files Browse the repository at this point in the history
  • Loading branch information
phip1611 committed Jun 19, 2023
1 parent 9eb9f23 commit 0bb79e9
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 4 deletions.
2 changes: 2 additions & 0 deletions multiboot2-header/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ required-features = ["builder"]
default = ["builder"]
alloc = []
builder = ["alloc"]
# Nightly-only features, which will eventually be stabilized.
unstable = []

[dependencies]
# used for MBI tags
Expand Down
2 changes: 2 additions & 0 deletions multiboot2-header/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
## Unreleased
- MSRV is 1.56.1
- renamed the `std` feature to `alloc`
- added the optional `unstable` feature (requires nightly)
- implement `core::error::Error` for `LoadError`

## v0.2.0 (2022-05-03)
- **BREAKING** renamed `EntryHeaderTag` to `EntryAddressHeaderTag`
Expand Down
11 changes: 10 additions & 1 deletion multiboot2-header/src/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::{
RelocatableHeaderTag,
};
use core::convert::TryInto;
use core::fmt::{Debug, Formatter};
use core::fmt::{Debug, Display, Formatter};
use core::mem::size_of;

/// Magic value for a [`Multiboot2Header`], as defined in spec.
Expand Down Expand Up @@ -212,6 +212,15 @@ pub enum LoadError {
TooSmall,
}

impl Display for LoadError {
fn fmt(&self, f: &mut Formatter<'_>) -> core::fmt::Result {
write!(f, "{:?}", self)
}
}

#[cfg(feature = "unstable")]
impl core::error::Error for LoadError {}

/// **Use this only if you know what you do. You probably want to use
/// [`Multiboot2Header`] instead.**
///
Expand Down
4 changes: 2 additions & 2 deletions multiboot2-header/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
//! The MSRV is 1.56.1 stable.

#![no_std]
#![cfg_attr(feature = "unstable", feature(error_in_core))]
#![deny(rustdoc::all)]
#![deny(clippy::all)]
#![deny(clippy::missing_const_for_fn)]
Expand Down Expand Up @@ -77,6 +78,5 @@ pub use self::relocatable::*;
pub use self::tags::*;
pub use self::uefi_bs::*;

/// Re-export of [`multiboot2::TagType`] from `multiboot2`-crate as `MbiTagType`, i.e. tags that
/// describe the entries in the Multiboot2 Information Structure (MBI).
/// Re-export of [`multiboot2::TagType`] from `multiboot2`-crate.
pub use multiboot2::TagType as MbiTagType;
2 changes: 1 addition & 1 deletion multiboot2/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ documentation = "https://docs.rs/multiboot2"
default = ["builder"]
alloc = []
builder = ["alloc"]
# Nightly-only features that will eventually be stabilized.
# Nightly-only features, which will eventually be stabilized.
unstable = []

[dependencies]
Expand Down

0 comments on commit 0bb79e9

Please sign in to comment.