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.
1 parent 787a0cc commit 1cd0e19Copy full SHA for 1cd0e19
ices/81270.rs
@@ -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
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