3 // Test that pointers and references to extern types are thin, ie they have the same size and
4 // alignment as a pointer to ().
5 #![feature(extern_types)]
7 use std::mem::{align_of, size_of};
18 struct Bar<T: ?Sized> {
23 fn assert_thin<T: ?Sized>() {
24 assert_eq!(size_of::<*const T>(), size_of::<*const ()>());
25 assert_eq!(align_of::<*const T>(), align_of::<*const ()>());
27 assert_eq!(size_of::<*mut T>(), size_of::<*mut ()>());
28 assert_eq!(align_of::<*mut T>(), align_of::<*mut ()>());
30 assert_eq!(size_of::<&T>(), size_of::<&()>());
31 assert_eq!(align_of::<&T>(), align_of::<&()>());
33 assert_eq!(size_of::<&mut T>(), size_of::<&mut ()>());
34 assert_eq!(align_of::<&mut T>(), align_of::<&mut ()>());
40 assert_thin::<Bar<A>>();
41 assert_thin::<Bar<Bar<A>>>();