From 307ee94a8a535019feadf69ce4258cdfb67a3a1c Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Mon, 7 Mar 2022 23:06:59 -0800 Subject: only emit pointer-like metadata for BZST-allocator Box --- .../debuginfo-box-with-large-allocator.rs | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 src/test/ui/debuginfo/debuginfo-box-with-large-allocator.rs (limited to 'src/test/ui/debuginfo/debuginfo-box-with-large-allocator.rs') 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, AllocError> { + todo!() + } + unsafe fn deallocate(&self, ptr: NonNull, layout: Layout) { + todo!() + } +} + +fn main() { + let _ = Box::::new_in(43, &ZST); +} -- cgit 1.4.1-3-g733a5