Closed
Description
enum Foo {}
impl Drop for Foo {
fn drop(&mut self) {}
}
fn main() {
unsafe { std::ptr::read(&1u8 as *const u8 as *const Foo) };
}
=> task 'rustc' failed at 'assertion failed: type_is_zero_size(bcx.ccx(), block_ty)'
Producing the value of the uninhabited type with transmute
instead of ptr::read
works "as expected". Another workaround is, of course, #![unsafe_no_drop_flag]
. ;)