summaryrefslogtreecommitdiffstats
path: root/src/test/ui/associated-type-bounds/entails-sized-object-safety.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
commit698f8c2f01ea549d77d7dc3338a12e04c11057b9 (patch)
tree173a775858bd501c378080a10dca74132f05bc50 /src/test/ui/associated-type-bounds/entails-sized-object-safety.rs
parentInitial commit. (diff)
downloadrustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.tar.xz
rustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.zip
Adding upstream version 1.64.0+dfsg1.upstream/1.64.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/ui/associated-type-bounds/entails-sized-object-safety.rs')
-rw-r--r--src/test/ui/associated-type-bounds/entails-sized-object-safety.rs26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/test/ui/associated-type-bounds/entails-sized-object-safety.rs b/src/test/ui/associated-type-bounds/entails-sized-object-safety.rs
new file mode 100644
index 000000000..f5a9bac6e
--- /dev/null
+++ b/src/test/ui/associated-type-bounds/entails-sized-object-safety.rs
@@ -0,0 +1,26 @@
+// build-pass (FIXME(62277): could be check-pass?)
+
+#![feature(associated_type_bounds)]
+
+trait Tr1: Sized { type As1; }
+trait Tr2<'a>: Sized { type As2; }
+
+trait ObjTr1 { fn foo() -> Self where Self: Tr1<As1: Copy>; }
+fn _assert_obj_safe_1(_: Box<dyn ObjTr1>) {}
+
+trait ObjTr2 { fn foo() -> Self where Self: Tr1<As1: 'static>; }
+fn _assert_obj_safe_2(_: Box<dyn ObjTr2>) {}
+
+trait ObjTr3 { fn foo() -> Self where Self: Tr1<As1: Into<u8> + 'static + Copy>; }
+fn _assert_obj_safe_3(_: Box<dyn ObjTr3>) {}
+
+trait ObjTr4 { fn foo() -> Self where Self: Tr1<As1: for<'a> Tr2<'a>>; }
+fn _assert_obj_safe_4(_: Box<dyn ObjTr4>) {}
+
+trait ObjTr5 { fn foo() -> Self where for<'a> Self: Tr1<As1: Tr2<'a>>; }
+fn _assert_obj_safe_5(_: Box<dyn ObjTr5>) {}
+
+trait ObjTr6 { fn foo() -> Self where Self: for<'a> Tr1<As1: Tr2<'a, As2: for<'b> Tr2<'b>>>; }
+fn _assert_obj_safe_6(_: Box<dyn ObjTr6>) {}
+
+fn main() {}