Skip to content

Commit

Permalink
Remove unsafe in Layout::pad_to_align
Browse files Browse the repository at this point in the history
  • Loading branch information
CAD97 authored Nov 25, 2019
1 parent b9da350 commit 6773064
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/libcore/alloc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6773064

Please sign in to comment.