Skip to content

Commit

Permalink
Add test for ICE
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnTitor committed Jun 8, 2019
1 parent c5295ac commit d69d0d7
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/test/ui/traits/trait-with-dst.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// compile-pass
// #55266

struct VTable<DST: ?Sized> {
_to_dst_ptr: fn(*mut ()) -> *mut DST,
}

trait HasVTableFor<DST: ?Sized + 'static> {
const VTABLE: &'static VTable<DST>;
}

impl<T, DST: ?Sized + 'static> HasVTableFor<DST> for T {
const VTABLE: &'static VTable<DST> = &VTable {
_to_dst_ptr: |_: *mut ()| unsafe { std::mem::zeroed() },
};
}

pub fn push<DST: ?Sized + 'static, T>() {
<T as HasVTableFor<DST>>::VTABLE;
}

fn main() {}

0 comments on commit d69d0d7

Please sign in to comment.