Rollup merge of #121224 - hi-rustin:rustin-patch-unit-binding, r=Mark-Simulacrum
Remove unnecessary unit binding It appears that the unit binding is not necessary at this time. However, I am unsure of its importance in the past. Please let me know if it is unsafe to remove.
This commit is contained in:
commit
c8f2a00aec
1 changed files with 2 additions and 2 deletions
|
@ -261,7 +261,7 @@ impl<T, A: Allocator> RawVec<T, A> {
|
||||||
// and could hypothetically handle differences between stride and size, but this memory
|
// and could hypothetically handle differences between stride and size, but this memory
|
||||||
// has already been allocated so we know it can't overflow and currently rust does not
|
// has already been allocated so we know it can't overflow and currently rust does not
|
||||||
// support such types. So we can do better by skipping some checks and avoid an unwrap.
|
// support such types. So we can do better by skipping some checks and avoid an unwrap.
|
||||||
let _: () = const { assert!(mem::size_of::<T>() % mem::align_of::<T>() == 0) };
|
const { assert!(mem::size_of::<T>() % mem::align_of::<T>() == 0) };
|
||||||
unsafe {
|
unsafe {
|
||||||
let align = mem::align_of::<T>();
|
let align = mem::align_of::<T>();
|
||||||
let size = mem::size_of::<T>().unchecked_mul(self.cap.0);
|
let size = mem::size_of::<T>().unchecked_mul(self.cap.0);
|
||||||
|
@ -465,7 +465,7 @@ impl<T, A: Allocator> RawVec<T, A> {
|
||||||
|
|
||||||
let (ptr, layout) = if let Some(mem) = self.current_memory() { mem } else { return Ok(()) };
|
let (ptr, layout) = if let Some(mem) = self.current_memory() { mem } else { return Ok(()) };
|
||||||
// See current_memory() why this assert is here
|
// See current_memory() why this assert is here
|
||||||
let _: () = const { assert!(mem::size_of::<T>() % mem::align_of::<T>() == 0) };
|
const { assert!(mem::size_of::<T>() % mem::align_of::<T>() == 0) };
|
||||||
|
|
||||||
// If shrinking to 0, deallocate the buffer. We don't reach this point
|
// If shrinking to 0, deallocate the buffer. We don't reach this point
|
||||||
// for the T::IS_ZST case since current_memory() will have returned
|
// for the T::IS_ZST case since current_memory() will have returned
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue