From 64d98f8ee037282c35007b64c2649055c56af1db Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:19:03 +0200 Subject: Merging upstream version 1.68.2+dfsg1. Signed-off-by: Daniel Baumann --- src/test/ui/traits/principal-less-objects.rs | 42 ---------------------------- 1 file changed, 42 deletions(-) delete mode 100644 src/test/ui/traits/principal-less-objects.rs (limited to 'src/test/ui/traits/principal-less-objects.rs') diff --git a/src/test/ui/traits/principal-less-objects.rs b/src/test/ui/traits/principal-less-objects.rs deleted file mode 100644 index 62bad0d7d..000000000 --- a/src/test/ui/traits/principal-less-objects.rs +++ /dev/null @@ -1,42 +0,0 @@ -// run-pass -// Check that trait objects without a principal codegen properly. - -use std::sync::atomic::{AtomicUsize, Ordering}; -use std::mem; - -// Array is to make sure the size is not exactly pointer-size, so -// we can be sure we are measuring the right size in the -// `size_of_val` test. -struct SetOnDrop<'a>(&'a AtomicUsize, #[allow(unused_tuple_struct_fields)] [u8; 64]); -impl<'a> Drop for SetOnDrop<'a> { - fn drop(&mut self) { - self.0.store(self.0.load(Ordering::Relaxed) + 1, Ordering::Relaxed); - } -} - -trait TypeEq {} -impl TypeEq for T {} -fn assert_types_eq() where U: TypeEq {} - -fn main() { - // Check that different ways of writing the same type are equal. - assert_types_eq::(); - assert_types_eq::(); - assert_types_eq::(); - - // Check that codegen works. - // - // Using `AtomicUsize` here because `Cell` is not `Sync`, and - // so can't be made into a `Box`. - let c = AtomicUsize::new(0); - { - let d: Box = Box::new(SetOnDrop(&c, [0; 64])); - - assert_eq!(mem::size_of_val(&*d), - mem::size_of::()); - assert_eq!(mem::align_of_val(&*d), - mem::align_of::()); - assert_eq!(c.load(Ordering::Relaxed), 0); - } - assert_eq!(c.load(Ordering::Relaxed), 1); -} -- cgit v1.2.3