about summary refs log tree commit diff
path: root/library/core/src/alloc/layout.rs
diff options
context:
space:
mode:
authorRune Tynan <runetynan@gmail.com>2022-11-12 14:21:18 -0500
committerRune Tynan <runetynan@gmail.com>2022-11-20 15:01:21 -0500
commit6f2dcac78b536ba66912346766059e52ff5e94a6 (patch)
treecf642b5c038a9425da92c7bfa31fa12eba7db928 /library/core/src/alloc/layout.rs
parent414e84a2f742b25f10edcfbf78be6779b4ea842b (diff)
downloadrust-6f2dcac78b536ba66912346766059e52ff5e94a6.tar.gz
rust-6f2dcac78b536ba66912346766059e52ff5e94a6.zip
Update with derive_const
Diffstat (limited to 'library/core/src/alloc/layout.rs')
-rw-r--r--library/core/src/alloc/layout.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/library/core/src/alloc/layout.rs b/library/core/src/alloc/layout.rs
index 2c1911c350e..bea62779bf8 100644
--- a/library/core/src/alloc/layout.rs
+++ b/library/core/src/alloc/layout.rs
@@ -326,7 +326,10 @@ impl Layout {
         let alloc_size = padded_size.checked_mul(n).ok_or(LayoutError)?;
 
         // The safe constructor is called here to enforce the isize size limit.
-        Layout::from_size_alignment(alloc_size, self.align).map(|layout| (layout, padded_size))
+        match Layout::from_size_alignment(alloc_size, self.align) {
+            Ok(layout) => Ok((layout, padded_size)),
+            Err(e) => Err(e),
+        }
     }
 
     /// Creates a layout describing the record for `self` followed by