From 9be35f82c1abf2ecbab489bca9eca138ea648312 Mon Sep 17 00:00:00 2001 From: Vadim Petrochenkov Date: Sat, 27 Jul 2019 01:33:01 +0300 Subject: tests: Move run-pass tests without naming conflicts to ui --- .../structs-enums/enum-null-pointer-opt.rs | 74 ---------------------- 1 file changed, 74 deletions(-) delete mode 100644 src/test/run-pass/structs-enums/enum-null-pointer-opt.rs (limited to 'src/test/run-pass/structs-enums/enum-null-pointer-opt.rs') diff --git a/src/test/run-pass/structs-enums/enum-null-pointer-opt.rs b/src/test/run-pass/structs-enums/enum-null-pointer-opt.rs deleted file mode 100644 index 32fdbf620a9..00000000000 --- a/src/test/run-pass/structs-enums/enum-null-pointer-opt.rs +++ /dev/null @@ -1,74 +0,0 @@ -// run-pass -#![feature(transparent_unions)] - -use std::mem::size_of; -use std::num::NonZeroUsize; -use std::ptr::NonNull; -use std::rc::Rc; -use std::sync::Arc; - -trait Trait { fn dummy(&self) { } } -trait Mirror { type Image; } -impl Mirror for T { type Image = T; } -struct ParamTypeStruct(T); -struct AssocTypeStruct(::Image); -#[repr(transparent)] -union MaybeUninitUnion { - _value: T, - _uninit: (), -} - -fn main() { - // Functions - assert_eq!(size_of::(), size_of::>()); - assert_eq!(size_of::(), size_of::>()); - - // Slices - &str / &[T] / &mut [T] - assert_eq!(size_of::<&str>(), size_of::>()); - assert_eq!(size_of::<&[isize]>(), size_of::>()); - assert_eq!(size_of::<&mut [isize]>(), size_of::>()); - - // Traits - Box / &Trait / &mut Trait - assert_eq!(size_of::>(), size_of::>>()); - assert_eq!(size_of::<&dyn Trait>(), size_of::>()); - assert_eq!(size_of::<&mut dyn Trait>(), size_of::>()); - - // Pointers - Box - assert_eq!(size_of::>(), size_of::>>()); - - // The optimization can't apply to raw pointers or unions with a ZST field. - assert!(size_of::>() != size_of::<*const isize>()); - assert!(Some(std::ptr::null::()).is_some()); // Can't collapse None to null - assert_ne!(size_of::(), size_of::>>()); - assert_ne!(size_of::<&str>(), size_of::>>()); - assert_ne!(size_of::>(), size_of::>>>()); - - struct Foo { - _a: Box - } - struct Bar(Box); - - // Should apply through structs - assert_eq!(size_of::(), size_of::>()); - assert_eq!(size_of::(), size_of::>()); - // and tuples - assert_eq!(size_of::<(u8, Box)>(), size_of::)>>()); - // and fixed-size arrays - assert_eq!(size_of::<[Box; 1]>(), size_of::; 1]>>()); - - // Should apply to NonZero - assert_eq!(size_of::(), size_of::>()); - assert_eq!(size_of::>(), size_of::>>()); - - // Should apply to types that use NonZero internally - assert_eq!(size_of::>(), size_of::>>()); - assert_eq!(size_of::>(), size_of::>>()); - assert_eq!(size_of::>(), size_of::>>()); - - // Should apply to types that have NonZero transitively - assert_eq!(size_of::(), size_of::>()); - - // Should apply to types where the pointer is substituted - assert_eq!(size_of::<&u8>(), size_of::>>()); - assert_eq!(size_of::<&u8>(), size_of::>>()); -} -- cgit 1.4.1-3-g733a5