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/object/auto-dedup.rs | 46 --------------------------------- 1 file changed, 46 deletions(-) delete mode 100644 src/test/ui/traits/object/auto-dedup.rs (limited to 'src/test/ui/traits/object/auto-dedup.rs') diff --git a/src/test/ui/traits/object/auto-dedup.rs b/src/test/ui/traits/object/auto-dedup.rs deleted file mode 100644 index 39d25eb7f..000000000 --- a/src/test/ui/traits/object/auto-dedup.rs +++ /dev/null @@ -1,46 +0,0 @@ -// run-pass - -#![allow(unused_assignments)] - -// Test that duplicate auto trait bounds in trait objects don't create new types. -#[allow(unused_assignments)] -use std::marker::Send as SendAlias; - -// A dummy trait for the non-auto trait. -trait Trait {} - -// A dummy struct to implement `Trait` and `Send`. -struct Struct; - -impl Trait for Struct {} - -// These three functions should be equivalent. -fn takes_dyn_trait_send(_: Box) {} -fn takes_dyn_trait_send_send(_: Box) {} -fn takes_dyn_trait_send_sendalias(_: Box) {} - -impl dyn Trait + Send + Send { - fn do_nothing(&self) {} -} - -fn main() { - // 1. Moving into a variable with more `Send`s and back. - let mut dyn_trait_send = Box::new(Struct) as Box; - let dyn_trait_send_send: Box = dyn_trait_send; - dyn_trait_send = dyn_trait_send_send; - - // 2. Calling methods with different number of `Send`s. - let dyn_trait_send = Box::new(Struct) as Box; - takes_dyn_trait_send_send(dyn_trait_send); - - let dyn_trait_send_send = Box::new(Struct) as Box; - takes_dyn_trait_send(dyn_trait_send_send); - - // 3. Aliases to the trait are transparent. - let dyn_trait_send = Box::new(Struct) as Box; - takes_dyn_trait_send_sendalias(dyn_trait_send); - - // 4. Calling an impl that duplicates an auto trait. - let dyn_trait_send = Box::new(Struct) as Box; - dyn_trait_send.do_nothing(); -} -- cgit v1.2.3