]> git.lizzy.rs Git - rust.git/blob - tests/ui/issues/issue-35570.rs
Auto merge of #107137 - Mark-Simulacrum:169, r=Mark-Simulacrum
[rust.git] / tests / 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     //~^ ERROR the trait bound `for<'a> (): Trait2<'a>` is not satisfied
10     //~| ERROR the trait bound `for<'a> (): Trait2<'a>` is not satisfied
11     let _e: (usize, usize) = unsafe{mem::transmute(param)};
12 }
13
14 trait Lifetime<'a> {
15     type Out;
16 }
17 impl<'a> Lifetime<'a> for () {
18     type Out = &'a ();
19 }
20 fn foo<'a>(x: &'a ()) -> <() as Lifetime<'a>>::Out {
21     x
22 }
23
24 fn takes_lifetime(_f: for<'a> fn(&'a ()) -> <() as Lifetime<'a>>::Out) {
25 }
26
27 fn main() {
28     takes_lifetime(foo);
29 }