Skip to content

Commit

Permalink
Add two ICEs for #92054
Browse files Browse the repository at this point in the history
rust-lang/rust#92054

Kudos to @mwerschy for reducing.
  • Loading branch information
BGR360 committed Dec 27, 2021
1 parent b7192e1 commit a72c2e3
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
9 changes: 9 additions & 0 deletions ices/92054-1.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#![feature(allocator_api)]

use std::alloc::{Allocator, Global, Layout};

fn main() {
let layout: Layout = None.unwrap();
let ptr: *mut u8 = Global.allocate(layout).unwrap().as_ptr() as _;
let box_ = unsafe { Box::from_raw_in(ptr, &Global) };
}
11 changes: 11 additions & 0 deletions ices/92054-2.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#![feature(allocator_api)]

use std::alloc::{Allocator, Global, Layout};

fn main() {
let layout: Layout = None.unwrap();
let ptr: *mut u8 = Global.allocate(layout).unwrap().as_ptr() as _;
let slice: &mut [u8] = unsafe { std::slice::from_raw_parts_mut(ptr, 0) };
let box_ = unsafe { Box::from_raw_in(slice, &Global) };
box_.len();
}

0 comments on commit a72c2e3

Please sign in to comment.