about summary refs log tree commit diff
path: root/src/libcore/alloc
diff options
context:
space:
mode:
authorChristopher Durham <cad97@cad97.com>2020-04-16 16:44:30 -0400
committerGitHub <noreply@github.com>2020-04-16 16:44:30 -0400
commit5f1fd9da5488cc2fe88dc89e5ca3f183526388a9 (patch)
tree88b02c5f9d9abad7d4f5e1fe9066b30f31e2a5c5 /src/libcore/alloc
parent053c2dddda209444e7dd0bc8df2f4b0f8337e9f5 (diff)
downloadrust-5f1fd9da5488cc2fe88dc89e5ca3f183526388a9.tar.gz
rust-5f1fd9da5488cc2fe88dc89e5ca3f183526388a9.zip
Apply suggestions from code review
Co-Authored-By: Ralf Jung <post@ralfj.de>
Diffstat (limited to 'src/libcore/alloc')
-rw-r--r--src/libcore/alloc/layout.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/libcore/alloc/layout.rs b/src/libcore/alloc/layout.rs
index 2ad36627403..be62671f59f 100644
--- a/src/libcore/alloc/layout.rs
+++ b/src/libcore/alloc/layout.rs
@@ -274,7 +274,8 @@ impl Layout {
     ///
     /// # 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 @@ impl Layout {
     ///         layout = new_layout;
     ///         offsets.push(offset);
     ///     }
+    ///     // Remember to finalize with `pad_to_align`!
     ///     Ok((layout.pad_to_align(), offsets))
     /// }
     /// # // test that it works