Skip to content

Commit

Permalink
Added test for #97732
Browse files Browse the repository at this point in the history
  • Loading branch information
Kixiron committed Jun 4, 2022
1 parent ba2f14e commit 857453d
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/test/ui/unsized/issue-97732.rs
Original file line number Diff line number Diff line change
@@ -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<T: ?Sized>(Box<T>, ());

impl<S: ?Sized, T: ?Sized> CoerceUnsized<BoxWithZstTail<T>> for BoxWithZstTail<S> where
Box<S>: CoerceUnsized<Box<T>>
{
}

pub fn noop_dyn_upcast_with_zst_tail(
b: BoxWithZstTail<dyn Send + Sync>,
) -> BoxWithZstTail<dyn Send> {
b
}

fn main() {}

0 comments on commit 857453d

Please sign in to comment.