summary refs log tree commit diff
path: root/src/test/ui/debuginfo/debuginfo-box-with-large-allocator.rs
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2022-03-07 23:06:59 -0800
committerMichael Goulet <michael@errs.io>2022-03-07 23:06:59 -0800
commit307ee94a8a535019feadf69ce4258cdfb67a3a1c (patch)
treebd7bbaa029de33dee460017726a9d733edafe63d /src/test/ui/debuginfo/debuginfo-box-with-large-allocator.rs
parent67b3e8183830c7af4e06a9aa91de4d1be3c860f7 (diff)
downloadrust-307ee94a8a535019feadf69ce4258cdfb67a3a1c.tar.gz
rust-307ee94a8a535019feadf69ce4258cdfb67a3a1c.zip
only emit pointer-like metadata for BZST-allocator Box
Diffstat (limited to 'src/test/ui/debuginfo/debuginfo-box-with-large-allocator.rs')
-rw-r--r--src/test/ui/debuginfo/debuginfo-box-with-large-allocator.rs23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/test/ui/debuginfo/debuginfo-box-with-large-allocator.rs b/src/test/ui/debuginfo/debuginfo-box-with-large-allocator.rs
new file mode 100644
index 00000000000..761539227a7
--- /dev/null
+++ b/src/test/ui/debuginfo/debuginfo-box-with-large-allocator.rs
@@ -0,0 +1,23 @@
+// build-pass
+// compile-flags: -Cdebuginfo=2
+// fixes issue #94725
+
+#![feature(allocator_api)]
+
+use std::alloc::{AllocError, Allocator, Layout};
+use std::ptr::NonNull;
+
+struct ZST;
+
+unsafe impl Allocator for &ZST {
+    fn allocate(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError> {
+        todo!()
+    }
+    unsafe fn deallocate(&self, ptr: NonNull<u8>, layout: Layout) {
+        todo!()
+    }
+}
+
+fn main() {
+    let _ = Box::<i32, &ZST>::new_in(43, &ZST);
+}