From 7ef2ba8f7b2b3076d906567bb107b0437c45be48 Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Mon, 25 Jul 2022 11:35:24 +0000 Subject: Fix size_of_val and min_align_of_val for truly unsized types --- example/std_example.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'example/std_example.rs') diff --git a/example/std_example.rs b/example/std_example.rs index 0a2bce2621d..0b5b6cd55d7 100644 --- a/example/std_example.rs +++ b/example/std_example.rs @@ -128,6 +128,25 @@ fn main() { 0 => loop {}, v => panic(v), }; + + if black_box(false) { + // Based on https://github.com/rust-lang/rust/blob/2f320a224e827b400be25966755a621779f797cc/src/test/ui/debuginfo/debuginfo_with_uninhabitable_field_and_unsized.rs + let _ = Foo::::new(); + + #[allow(dead_code)] + struct Foo { + base: Never, + value: T, + } + + impl Foo { + pub fn new() -> Box> { + todo!() + } + } + + enum Never {} + } } fn panic(_: u128) { -- cgit 1.4.1-3-g733a5