Better function calls

This commit is contained in:
Nick Cameron
2015-09-24 11:32:01 +12:00
parent 06812c2999
commit 459f7720b9
4 changed files with 32 additions and 10 deletions

View File

@@ -34,8 +34,12 @@ extern {
#[inline(always)]
fn check_size_and_alignment(size: usize, align: usize) {
debug_assert!(size != 0);
debug_assert!(size <= isize::MAX as usize, "Tried to allocate too much: {} bytes", size);
debug_assert!(usize::is_power_of_two(align), "Invalid alignment of allocation: {}", align);
debug_assert!(size <= isize::MAX as usize,
"Tried to allocate too much: {} bytes",
size);
debug_assert!(usize::is_power_of_two(align),
"Invalid alignment of allocation: {}",
align);
}
// FIXME: #13996: mark the `allocate` and `reallocate` return value as `noalias`