forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#94414 - DrMeepster:box_alloc_ice2, r=tmiasko
Fix ICE when using Box<T, A> with large A A sequel to rust-lang#94043 that fixes rust-lang#81270 and rust-lang#92054 (duplicate).
- Loading branch information
Showing
3 changed files
with
35 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// build-pass | ||
#![feature(allocator_api)] | ||
|
||
use std::alloc::Allocator; | ||
|
||
struct BigAllocator([usize; 2]); | ||
|
||
unsafe impl Allocator for BigAllocator { | ||
fn allocate( | ||
&self, | ||
_: std::alloc::Layout, | ||
) -> Result<std::ptr::NonNull<[u8]>, std::alloc::AllocError> { | ||
todo!() | ||
} | ||
unsafe fn deallocate(&self, _: std::ptr::NonNull<u8>, _: std::alloc::Layout) { | ||
todo!() | ||
} | ||
} | ||
|
||
fn main() { | ||
Box::new_in((), &std::alloc::Global); | ||
Box::new_in((), BigAllocator([0; 2])); | ||
} |