From 5f1fd9da5488cc2fe88dc89e5ca3f183526388a9 Mon Sep 17 00:00:00 2001 From: Christopher Durham Date: Thu, 16 Apr 2020 16:44:30 -0400 Subject: [PATCH] Apply suggestions from code review Co-Authored-By: Ralf Jung --- src/libcore/alloc/layout.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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