From 698f8c2f01ea549d77d7dc3338a12e04c11057b9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:02:58 +0200 Subject: Adding upstream version 1.64.0+dfsg1. Signed-off-by: Daniel Baumann --- src/test/ui/traits/alias/object-wf.rs | 85 +++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 src/test/ui/traits/alias/object-wf.rs (limited to 'src/test/ui/traits/alias/object-wf.rs') diff --git a/src/test/ui/traits/alias/object-wf.rs b/src/test/ui/traits/alias/object-wf.rs new file mode 100644 index 000000000..1440f02df --- /dev/null +++ b/src/test/ui/traits/alias/object-wf.rs @@ -0,0 +1,85 @@ +// check-pass + +// This test checks that trait objects involving trait aliases are well-formed. + +#![feature(trait_alias)] + +trait Obj {} + +trait _0 = Send + Sync; + +// Just auto traits: + +trait _1 = _0 + Send + Sync; + +use std::marker::Unpin; + +fn _f0() { + let _: Box; + let _: Box; + let _: Box; +} + +// Include object safe traits: + +fn _f1() { + let _: Box; + let _: Box; + let _: Box; +} + +// And when the object safe trait is in a trait alias: + +trait _2 = Obj; + +fn _f2() { + let _: Box; + let _: Box; + let _: Box; +} + +// And it should also work when that trait is has auto traits to the right of it. + +trait _3 = Obj + Unpin; + +fn _f3() { + let _: Box; + let _: Box; + let _: Box; +} + +// Nest the trait deeply: + +trait _4 = _3; +trait _5 = _4 + Sync + _0 + Send; +trait _6 = _5 + Send + _1 + Sync; + +fn _f4() { + let _: Box; + let _: Box; + let _: Box; +} + +// Just nest the trait alone: + +trait _7 = _2; +trait _8 = _7; +trait _9 = _8; + +fn _f5() { + let _: Box; +} + +// First bound is auto trait: + +trait _10 = Send + Obj; +trait _11 = Obj + Send; +trait _12 = Sync + _11; +trait _13 = Send + _12; + +fn f6() { + let _: Box; + let _: Box; +} + +fn main() {} -- cgit v1.2.3