diff --git a/src/libcore/alloc/layout.rs b/src/libcore/alloc/layout.rs index 2ad366274030..be62671f59f4 100644 --- a/src/libcore/alloc/layout.rs +++ b/src/libcore/alloc/layout.rs @@ -274,7 +274,8 @@ pub fn repeat(&self, n: usize) -> Result<(Self, usize), LayoutErr> { /// /// # Examples /// - /// To calculate the layout of a `#[repr(C)]` structure from its fields' layouts: + /// To calculate the layout of a `#[repr(C)]` structure and the offsets of + /// the fields from its fields' layouts: /// /// ```rust /// # use std::alloc::{Layout, LayoutErr}; @@ -286,6 +287,7 @@ pub fn repeat(&self, n: usize) -> Result<(Self, usize), LayoutErr> { /// layout = new_layout; /// offsets.push(offset); /// } + /// // Remember to finalize with `pad_to_align`! /// Ok((layout.pad_to_align(), offsets)) /// } /// # // test that it works