Skip to content

Commit 0bb79e9

Browse files
committed
multiboot2-header: add unstable feature
1 parent 9eb9f23 commit 0bb79e9

File tree

5 files changed

+17
-4
lines changed

5 files changed

+17
-4
lines changed

multiboot2-header/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ required-features = ["builder"]
3535
default = ["builder"]
3636
alloc = []
3737
builder = ["alloc"]
38+
# Nightly-only features, which will eventually be stabilized.
39+
unstable = []
3840

3941
[dependencies]
4042
# used for MBI tags

multiboot2-header/Changelog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
## Unreleased
44
- MSRV is 1.56.1
55
- renamed the `std` feature to `alloc`
6+
- added the optional `unstable` feature (requires nightly)
7+
- implement `core::error::Error` for `LoadError`
68

79
## v0.2.0 (2022-05-03)
810
- **BREAKING** renamed `EntryHeaderTag` to `EntryAddressHeaderTag`

multiboot2-header/src/header.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use crate::{
55
RelocatableHeaderTag,
66
};
77
use core::convert::TryInto;
8-
use core::fmt::{Debug, Formatter};
8+
use core::fmt::{Debug, Display, Formatter};
99
use core::mem::size_of;
1010

1111
/// Magic value for a [`Multiboot2Header`], as defined in spec.
@@ -212,6 +212,15 @@ pub enum LoadError {
212212
TooSmall,
213213
}
214214

215+
impl Display for LoadError {
216+
fn fmt(&self, f: &mut Formatter<'_>) -> core::fmt::Result {
217+
write!(f, "{:?}", self)
218+
}
219+
}
220+
221+
#[cfg(feature = "unstable")]
222+
impl core::error::Error for LoadError {}
223+
215224
/// **Use this only if you know what you do. You probably want to use
216225
/// [`Multiboot2Header`] instead.**
217226
///

multiboot2-header/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
//! The MSRV is 1.56.1 stable.
3535
3636
#![no_std]
37+
#![cfg_attr(feature = "unstable", feature(error_in_core))]
3738
#![deny(rustdoc::all)]
3839
#![deny(clippy::all)]
3940
#![deny(clippy::missing_const_for_fn)]
@@ -77,6 +78,5 @@ pub use self::relocatable::*;
7778
pub use self::tags::*;
7879
pub use self::uefi_bs::*;
7980

80-
/// Re-export of [`multiboot2::TagType`] from `multiboot2`-crate as `MbiTagType`, i.e. tags that
81-
/// describe the entries in the Multiboot2 Information Structure (MBI).
81+
/// Re-export of [`multiboot2::TagType`] from `multiboot2`-crate.
8282
pub use multiboot2::TagType as MbiTagType;

multiboot2/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ documentation = "https://docs.rs/multiboot2"
3636
default = ["builder"]
3737
alloc = []
3838
builder = ["alloc"]
39-
# Nightly-only features that will eventually be stabilized.
39+
# Nightly-only features, which will eventually be stabilized.
4040
unstable = []
4141

4242
[dependencies]

0 commit comments

Comments
 (0)