Skip to content

Commit 1cd0e19

Browse files
committed
Add 81270
Issue: rust-lang/rust#81270
1 parent 787a0cc commit 1cd0e19

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

ices/81270.rs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#![feature(allocator_api)]
2+
use std::alloc::{AllocError, Allocator, Global, Layout};
3+
use std::marker::PhantomData;
4+
use std::ptr::NonNull;
5+
6+
struct S<A> {
7+
a: PhantomData<A>,
8+
b: [u8; 1],
9+
}
10+
unsafe impl<A> Allocator for S<A> {
11+
fn allocate(&self, _: Layout) -> Result<NonNull<[u8]>, AllocError> {
12+
todo!();
13+
}
14+
unsafe fn deallocate(&self, _: NonNull<u8>, _: Layout) {
15+
todo!();
16+
}
17+
}
18+
19+
fn main() {
20+
let x: Box<u8, S<u8>> = Box::new_in(
21+
0,
22+
S {
23+
a: PhantomData,
24+
b: [0; 1],
25+
},
26+
);
27+
}

0 commit comments

Comments
 (0)