Skip to content

Commit 45d7c84

Browse files
committed
Update documentation to note the weird panic message.
Signed-off-by: Joe Richey <[email protected]>
1 parent 2bbaebb commit 45d7c84

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

src/addr.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -531,8 +531,10 @@ impl Sub<PhysAddr> for PhysAddr {
531531

532532
/// Align address downwards.
533533
///
534-
/// Returns the greatest x with alignment `align` so that x <= addr. The alignment must be
535-
/// a power of 2.
534+
/// Returns the greatest `x` with alignment `align` so that `x <= addr`.
535+
///
536+
/// Panics if the alignment is not a power of two. Without the `const_fn`
537+
/// feature, the panic message will be "index out of bounds".
536538
#[inline]
537539
pub const fn align_down(addr: u64, align: u64) -> u64 {
538540
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 {
541543

542544
/// Align address upwards.
543545
///
544-
/// Returns the smallest x with alignment `align` so that x >= addr. The alignment must be
545-
/// a power of 2.
546+
/// Returns the smallest `x` with alignment `align` so that `x >= addr`.
547+
///
548+
/// Panics if the alignment is not a power of two. Without the `const_fn`
549+
/// feature, the panic message will be "index out of bounds".
546550
#[inline]
547551
pub const fn align_up(addr: u64, align: u64) -> u64 {
548552
const_assert!(align.is_power_of_two(), "`align` must be a power of two");

src/structures/gdt.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,8 @@ impl GlobalDescriptorTable {
141141
const_fn! {
142142
/// Adds the given segment descriptor to the GDT, returning the segment selector.
143143
///
144-
/// Panics if the GDT has no free entries left.
144+
/// Panics if the GDT has no free entries left. Without the `const_fn`
145+
/// feature, the panic message will be "index out of bounds".
145146
#[inline]
146147
pub fn add_entry(&mut self, entry: Descriptor) -> SegmentSelector {
147148
let index = match entry {

0 commit comments

Comments
 (0)