diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2023-09-20 07:45:46 +1000 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2023-09-28 15:44:48 +1000 |
| commit | 98d97b7323a55fce821bab6606bf216dbb97523a (patch) | |
| tree | df276d610c94784b5318f60f4bf4fd26fcbeb95f /compiler/rustc_arena | |
| parent | 51edc219906f0973dd66b4b6ff5ff0ac857a4cc6 (diff) | |
| download | rust-98d97b7323a55fce821bab6606bf216dbb97523a.tar.gz rust-98d97b7323a55fce821bab6606bf216dbb97523a.zip | |
Use `Layout::new` consistently in `DroplessArena::alloc`.
Diffstat (limited to 'compiler/rustc_arena')
| -rw-r--r-- | compiler/rustc_arena/src/lib.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/compiler/rustc_arena/src/lib.rs b/compiler/rustc_arena/src/lib.rs index 5c183afc087..d793158d85f 100644 --- a/compiler/rustc_arena/src/lib.rs +++ b/compiler/rustc_arena/src/lib.rs @@ -501,12 +501,13 @@ impl DroplessArena { assert!(!mem::needs_drop::<T>()); assert!(mem::size_of::<T>() != 0); - let mem = if let Some(a) = self.alloc_raw_without_grow(Layout::for_value::<T>(&object)) { + let layout = Layout::new::<T>(); + let mem = if let Some(a) = self.alloc_raw_without_grow(layout) { a } else { // No free space left. Allocate a new chunk to satisfy the request. // On failure the grow will panic or abort. - self.grow_and_alloc_raw(Layout::new::<T>()) + self.grow_and_alloc_raw(layout) } as *mut T; unsafe { |
