- 
        Couldn't load subscription status. 
- Fork 13.9k
Closed
Labels
C-bugCategory: This is a bug.Category: This is a bug.F-extern_types`#![feature(extern_types)]``#![feature(extern_types)]`requires-nightlyThis issue requires a nightly compiler in some way.This issue requires a nightly compiler in some way.
Description
Hello, following code on nightly playground returns zero, indicating extern type behaving like ZST, while in comparison, size_of fails to compile. According to the RFC, panicking or compilation failure should happen, so this behavior seem incorrect.
#![feature(extern_types)]
extern {
    type Foo;
}
pub fn test() -> usize {
    let ptr: *mut Foo = std::ptr::null_mut();
    unsafe{std::mem::size_of_val::<Foo>(&*ptr)}
}Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.F-extern_types`#![feature(extern_types)]``#![feature(extern_types)]`requires-nightlyThis issue requires a nightly compiler in some way.This issue requires a nightly compiler in some way.