about summary refs log tree commit diff
path: root/src/libcore
diff options
context:
space:
mode:
authorChristopher Durham <cad97@cad97.com>2019-11-25 16:05:33 -0500
committerGitHub <noreply@github.com>2019-11-25 16:05:33 -0500
commit6773064b0529c258c4f69bb7848371553447b088 (patch)
tree8ef4006ba812d1a156be730350d2e2d016cc5113 /src/libcore
parentb9da350b09385dd969f5da3c3f9be0b356897099 (diff)
downloadrust-6773064b0529c258c4f69bb7848371553447b088.tar.gz
rust-6773064b0529c258c4f69bb7848371553447b088.zip
Remove unsafe in Layout::pad_to_align
Diffstat (limited to 'src/libcore')
-rw-r--r--src/libcore/alloc.rs4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/libcore/alloc.rs b/src/libcore/alloc.rs
index d08440192b0..68fa2b5c20d 100644
--- a/src/libcore/alloc.rs
+++ b/src/libcore/alloc.rs
@@ -225,9 +225,7 @@ impl Layout {
         // > `usize::MAX`)
         let new_size = self.size() + pad;
 
-        // SAFETY: This necessarily respects the from_size_align
-        // prerequisites per the above.
-        unsafe { Layout::from_size_align_unchecked(new_size, self.align()) }
+        Layout::from_size_align(new_size, self.align()).unwrap()
     }
 
     /// Creates a layout describing the record for `n` instances of