File tree Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change 8
8
available regardless of whether the ` global_allocator ` feature is enabled. The
9
9
` global_allocator ` feature now only controls whether ` allocator::Allocator ` is
10
10
set as Rust's global allocator.
11
+ - ` Error::new ` and ` Error::from ` now panic if the status is ` SUCCESS ` .
11
12
12
13
## uefi-macros - [ Unreleased]
13
14
Original file line number Diff line number Diff line change @@ -14,7 +14,12 @@ pub struct Error<Data: Debug = ()> {
14
14
15
15
impl < Data : Debug > Error < Data > {
16
16
/// Create an `Error`.
17
+ ///
18
+ /// # Panics
19
+ ///
20
+ /// Panics if `status` is [`Status::SUCCESS`].
17
21
pub const fn new ( status : Status , data : Data ) -> Self {
22
+ assert ! ( !matches!( status, Status :: SUCCESS ) ) ;
18
23
Self { status, data }
19
24
}
20
25
@@ -39,7 +44,7 @@ impl<Data: Debug> Error<Data> {
39
44
40
45
impl From < Status > for Error < ( ) > {
41
46
fn from ( status : Status ) -> Self {
42
- Self { status, data : ( ) }
47
+ Error :: new ( status, ( ) )
43
48
}
44
49
}
45
50
You can’t perform that action at this time.
0 commit comments