diff --git a/src/test/ui/unsized/issue-97732.rs b/src/test/ui/unsized/issue-97732.rs new file mode 100644 index 00000000000..172f0724d42 --- /dev/null +++ b/src/test/ui/unsized/issue-97732.rs @@ -0,0 +1,23 @@ +// check-pass + +#![feature(coerce_unsized)] + +// Ensure that unsizing structs that contain ZSTs at non-zero offsets don't ICE + +use std::ops::CoerceUnsized; + +#[repr(C)] +pub struct BoxWithZstTail(Box, ()); + +impl CoerceUnsized> for BoxWithZstTail where + Box: CoerceUnsized> +{ +} + +pub fn noop_dyn_upcast_with_zst_tail( + b: BoxWithZstTail, +) -> BoxWithZstTail { + b +} + +fn main() {}