Skip to content

Commit 8e030f8

Browse files
committed
fix(idt): panic in impl fmt::Debug for EntryOptions
1 parent 7f4d2bb commit 8e030f8

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/structures/idt.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1002,8 +1002,8 @@ impl EntryOptions {
10021002
self
10031003
}
10041004

1005-
fn stack_index(&self) -> u16 {
1006-
self.bits.get_bits(0..3) - 1
1005+
fn stack_index(&self) -> Option<u16> {
1006+
self.bits.get_bits(0..3).checked_sub(1)
10071007
}
10081008
}
10091009

@@ -1720,6 +1720,11 @@ mod test {
17201720
}
17211721
}
17221722

1723+
#[test]
1724+
fn idt_fmt_debug() {
1725+
dbg!(InterruptDescriptorTable::new());
1726+
}
1727+
17231728
#[test]
17241729
fn entry_derive_test() {
17251730
fn foo(_: impl Copy + PartialEq + fmt::Debug) {}

0 commit comments

Comments
 (0)