]> git.lizzy.rs Git - rust.git/blob - src/test/ui/associated-type-bounds/entails-sized-object-safety.rs
Auto merge of #81507 - weiznich:add_diesel_to_cargo_test, r=Mark-Simulacrum
[rust.git] / src / test / ui / associated-type-bounds / entails-sized-object-safety.rs
1 // build-pass (FIXME(62277): could be check-pass?)
2
3 #![feature(associated_type_bounds)]
4
5 trait Tr1: Sized { type As1; }
6 trait Tr2<'a>: Sized { type As2; }
7
8 trait ObjTr1 { fn foo() -> Self where Self: Tr1<As1: Copy>; }
9 fn _assert_obj_safe_1(_: Box<dyn ObjTr1>) {}
10
11 trait ObjTr2 { fn foo() -> Self where Self: Tr1<As1: 'static>; }
12 fn _assert_obj_safe_2(_: Box<dyn ObjTr2>) {}
13
14 trait ObjTr3 { fn foo() -> Self where Self: Tr1<As1: Into<u8> + 'static + Copy>; }
15 fn _assert_obj_safe_3(_: Box<dyn ObjTr3>) {}
16
17 trait ObjTr4 { fn foo() -> Self where Self: Tr1<As1: for<'a> Tr2<'a>>; }
18 fn _assert_obj_safe_4(_: Box<dyn ObjTr4>) {}
19
20 trait ObjTr5 { fn foo() -> Self where for<'a> Self: Tr1<As1: Tr2<'a>>; }
21 fn _assert_obj_safe_5(_: Box<dyn ObjTr5>) {}
22
23 trait ObjTr6 { fn foo() -> Self where Self: for<'a> Tr1<As1: Tr2<'a, As2: for<'b> Tr2<'b>>>; }
24 fn _assert_obj_safe_6(_: Box<dyn ObjTr6>) {}
25
26 fn main() {}