summaryrefslogtreecommitdiffstats
path: root/src/test/ui/associated-type-bounds/entails-sized-object-safety.rs
blob: f5a9bac6e3549bb8f5f366194619db93bd2d8a4d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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() {}