Skip to content

Commit d69d0d7

Browse files
committed
Add test for ICE
1 parent c5295ac commit d69d0d7

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

src/test/ui/traits/trait-with-dst.rs

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// compile-pass
2+
// #55266
3+
4+
struct VTable<DST: ?Sized> {
5+
_to_dst_ptr: fn(*mut ()) -> *mut DST,
6+
}
7+
8+
trait HasVTableFor<DST: ?Sized + 'static> {
9+
const VTABLE: &'static VTable<DST>;
10+
}
11+
12+
impl<T, DST: ?Sized + 'static> HasVTableFor<DST> for T {
13+
const VTABLE: &'static VTable<DST> = &VTable {
14+
_to_dst_ptr: |_: *mut ()| unsafe { std::mem::zeroed() },
15+
};
16+
}
17+
18+
pub fn push<DST: ?Sized + 'static, T>() {
19+
<T as HasVTableFor<DST>>::VTABLE;
20+
}
21+
22+
fn main() {}

0 commit comments

Comments
 (0)