diff options
| author | Dylan DPC <99973273+Dylan-DPC@users.noreply.github.com> | 2022-03-10 23:13:00 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-03-10 23:13:00 +0100 |
| commit | b18b2d1bcd07ac90cbae0918f344e8e723fe7688 (patch) | |
| tree | 9e674a89afba743410a4aa7d7e8c7c04f587fc58 /src | |
| parent | 1cf879355ba39946f59bb90149b09d3b85567230 (diff) | |
| parent | 307ee94a8a535019feadf69ce4258cdfb67a3a1c (diff) | |
| download | rust-b18b2d1bcd07ac90cbae0918f344e8e723fe7688.tar.gz rust-b18b2d1bcd07ac90cbae0918f344e8e723fe7688.zip | |
Rollup merge of #94728 - compiler-errors:box-allocator-zst-meta, r=michaelwoerister
Only emit pointer-like metadata for `Box<T, A>` when `A` is ZST Basically copy the change in #94043, but for debuginfo. r? ``@michaelwoerister`` Fixes #94725
Diffstat (limited to 'src')
| -rw-r--r-- | src/test/ui/debuginfo/debuginfo-box-with-large-allocator.rs | 23 | ||||
| -rw-r--r-- | src/test/ui/debuginfo/debuginfo_with_uninhabitable_field_and_unsized.rs | 2 |
2 files changed, 24 insertions, 1 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); +} diff --git a/src/test/ui/debuginfo/debuginfo_with_uninhabitable_field_and_unsized.rs b/src/test/ui/debuginfo/debuginfo_with_uninhabitable_field_and_unsized.rs index 833a4726acb..b3f22ecf511 100644 --- a/src/test/ui/debuginfo/debuginfo_with_uninhabitable_field_and_unsized.rs +++ b/src/test/ui/debuginfo/debuginfo_with_uninhabitable_field_and_unsized.rs @@ -1,4 +1,4 @@ -// check-pass +// build-pass // compile-flags: -Cdebuginfo=2 // fixes issue #94149 |
