Skip to content

Commit c8f2a00

Browse files
authored
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.
2 parents ddf6c6d + 6f1383c commit c8f2a00

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

library/alloc/src/raw_vec.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ impl<T, A: Allocator> RawVec<T, A> {
261261
// and could hypothetically handle differences between stride and size, but this memory
262262
// has already been allocated so we know it can't overflow and currently rust does not
263263
// support such types. So we can do better by skipping some checks and avoid an unwrap.
264-
let _: () = const { assert!(mem::size_of::<T>() % mem::align_of::<T>() == 0) };
264+
const { assert!(mem::size_of::<T>() % mem::align_of::<T>() == 0) };
265265
unsafe {
266266
let align = mem::align_of::<T>();
267267
let size = mem::size_of::<T>().unchecked_mul(self.cap.0);
@@ -465,7 +465,7 @@ impl<T, A: Allocator> RawVec<T, A> {
465465

466466
let (ptr, layout) = if let Some(mem) = self.current_memory() { mem } else { return Ok(()) };
467467
// See current_memory() why this assert is here
468-
let _: () = const { assert!(mem::size_of::<T>() % mem::align_of::<T>() == 0) };
468+
const { assert!(mem::size_of::<T>() % mem::align_of::<T>() == 0) };
469469

470470
// If shrinking to 0, deallocate the buffer. We don't reach this point
471471
// for the T::IS_ZST case since current_memory() will have returned

0 commit comments

Comments
 (0)