]> git.proxmox.com Git - rustc.git/blob - src/test/ui/issues/issue-35570.rs
New upstream version 1.60.0+dfsg1
[rustc.git] / src / test / ui / issues / issue-35570.rs
1 use std::mem;
2
3 trait Trait1<T> {}
4 trait Trait2<'a> {
5 type Ty;
6 }
7
8 fn _ice(param: Box<dyn for <'a> Trait1<<() as Trait2<'a>>::Ty>>) {
9 //~^ the trait bound `for<'a> (): Trait2<'a>` is not satisfied
10 let _e: (usize, usize) = unsafe{mem::transmute(param)};
11 }
12
13 trait Lifetime<'a> {
14 type Out;
15 }
16 impl<'a> Lifetime<'a> for () {
17 type Out = &'a ();
18 }
19 fn foo<'a>(x: &'a ()) -> <() as Lifetime<'a>>::Out {
20 x
21 }
22
23 fn takes_lifetime(_f: for<'a> fn(&'a ()) -> <() as Lifetime<'a>>::Out) {
24 }
25
26 fn main() {
27 takes_lifetime(foo);
28 }