Skip to content

Commit 857453d

Browse files
committed
Added test for rust-lang#97732
1 parent ba2f14e commit 857453d

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

src/test/ui/unsized/issue-97732.rs

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// check-pass
2+
3+
#![feature(coerce_unsized)]
4+
5+
// Ensure that unsizing structs that contain ZSTs at non-zero offsets don't ICE
6+
7+
use std::ops::CoerceUnsized;
8+
9+
#[repr(C)]
10+
pub struct BoxWithZstTail<T: ?Sized>(Box<T>, ());
11+
12+
impl<S: ?Sized, T: ?Sized> CoerceUnsized<BoxWithZstTail<T>> for BoxWithZstTail<S> where
13+
Box<S>: CoerceUnsized<Box<T>>
14+
{
15+
}
16+
17+
pub fn noop_dyn_upcast_with_zst_tail(
18+
b: BoxWithZstTail<dyn Send + Sync>,
19+
) -> BoxWithZstTail<dyn Send> {
20+
b
21+
}
22+
23+
fn main() {}

0 commit comments

Comments
 (0)