We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Layout::new
DroplessArena::alloc
1 parent 51edc21 commit 98d97b7Copy full SHA for 98d97b7
compiler/rustc_arena/src/lib.rs
@@ -501,12 +501,13 @@ impl DroplessArena {
501
assert!(!mem::needs_drop::<T>());
502
assert!(mem::size_of::<T>() != 0);
503
504
- let mem = if let Some(a) = self.alloc_raw_without_grow(Layout::for_value::<T>(&object)) {
+ let layout = Layout::new::<T>();
505
+ let mem = if let Some(a) = self.alloc_raw_without_grow(layout) {
506
a
507
} else {
508
// No free space left. Allocate a new chunk to satisfy the request.
509
// On failure the grow will panic or abort.
- self.grow_and_alloc_raw(Layout::new::<T>())
510
+ self.grow_and_alloc_raw(layout)
511
} as *mut T;
512
513
unsafe {
0 commit comments