Skip to content

Commit cdeae7c

Browse files
authored
Add Panics section in PhysAddr and VirtAddr docs (#185)
1 parent ad68347 commit cdeae7c

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/addr.rs

+8-3
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,11 @@ pub struct VirtAddrNotValid(u64);
4343
impl VirtAddr {
4444
/// Creates a new canonical virtual address.
4545
///
46-
/// This function performs sign extension of bit 47 to make the address canonical. Panics
47-
/// if the bits in the range 48 to 64 contain data (i.e. are not null and no sign extension).
46+
/// This function performs sign extension of bit 47 to make the address canonical.
47+
///
48+
/// ## Panics
49+
///
50+
/// This function panics if the bits in the range 48 to 64 contain data (i.e. are not null and no sign extension).
4851
#[inline]
4952
pub fn new(addr: u64) -> VirtAddr {
5053
Self::try_new(addr).expect(
@@ -289,7 +292,9 @@ pub struct PhysAddrNotValid(u64);
289292
impl PhysAddr {
290293
/// Creates a new physical address.
291294
///
292-
/// Panics if a bit in the range 52 to 64 is set.
295+
/// ## Panics
296+
///
297+
/// This function panics if a bit in the range 52 to 64 is set.
293298
#[inline]
294299
pub fn new(addr: u64) -> PhysAddr {
295300
assert_eq!(

0 commit comments

Comments
 (0)