diff --git a/src/addr.rs b/src/addr.rs index 942376095..1c93f0219 100644 --- a/src/addr.rs +++ b/src/addr.rs @@ -531,8 +531,10 @@ impl Sub for PhysAddr { /// Align address downwards. /// -/// Returns the greatest x with alignment `align` so that x <= addr. The alignment must be -/// a power of 2. +/// Returns the greatest `x` with alignment `align` so that `x <= addr`. +/// +/// Panics if the alignment is not a power of two. Without the `const_fn` +/// feature, the panic message will be "index out of bounds". #[inline] pub const fn align_down(addr: u64, align: u64) -> u64 { const_assert!(align.is_power_of_two(), "`align` must be a power of two"); @@ -541,8 +543,10 @@ pub const fn align_down(addr: u64, align: u64) -> u64 { /// Align address upwards. /// -/// Returns the smallest x with alignment `align` so that x >= addr. The alignment must be -/// a power of 2. +/// Returns the smallest `x` with alignment `align` so that `x >= addr`. +/// +/// Panics if the alignment is not a power of two. Without the `const_fn` +/// feature, the panic message will be "index out of bounds". #[inline] pub const fn align_up(addr: u64, align: u64) -> u64 { const_assert!(align.is_power_of_two(), "`align` must be a power of two"); diff --git a/src/structures/gdt.rs b/src/structures/gdt.rs index aa95ccf61..c96d81161 100644 --- a/src/structures/gdt.rs +++ b/src/structures/gdt.rs @@ -141,7 +141,8 @@ impl GlobalDescriptorTable { const_fn! { /// Adds the given segment descriptor to the GDT, returning the segment selector. /// - /// Panics if the GDT has no free entries left. + /// Panics if the GDT has no free entries left. Without the `const_fn` + /// feature, the panic message will be "index out of bounds". #[inline] pub fn add_entry(&mut self, entry: Descriptor) -> SegmentSelector { let index = match entry {