]> git.lizzy.rs Git - rust.git/blob - src/test/ui/anonymous-higher-ranked-lifetime.rs
Auto merge of #54624 - arielb1:evaluate-outlives, r=nikomatsakis
[rust.git] / src / test / ui / anonymous-higher-ranked-lifetime.rs
1 // Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 fn main() {
12     f1(|_: (), _: ()| {}); //~ ERROR type mismatch
13     f2(|_: (), _: ()| {}); //~ ERROR type mismatch
14     f3(|_: (), _: ()| {}); //~ ERROR type mismatch
15     f4(|_: (), _: ()| {}); //~ ERROR type mismatch
16     f5(|_: (), _: ()| {}); //~ ERROR type mismatch
17     g1(|_: (), _: ()| {}); //~ ERROR type mismatch
18     g2(|_: (), _: ()| {}); //~ ERROR type mismatch
19     g3(|_: (), _: ()| {}); //~ ERROR type mismatch
20     g4(|_: (), _: ()| {}); //~ ERROR type mismatch
21     h1(|_: (), _: (), _: (), _: ()| {}); //~ ERROR type mismatch
22     h2(|_: (), _: (), _: (), _: ()| {}); //~ ERROR type mismatch
23 }
24
25 // Basic
26 fn f1<F>(_: F) where F: Fn(&(), &()) {}
27 fn f2<F>(_: F) where F: for<'a> Fn(&'a (), &()) {}
28 fn f3<'a, F>(_: F) where F: Fn(&'a (), &()) {}
29 fn f4<F>(_: F) where F: for<'r> Fn(&(), &'r ()) {}
30 fn f5<F>(_: F) where F: for<'r> Fn(&'r (), &'r ()) {}
31
32 // Nested
33 fn g1<F>(_: F) where F: Fn(&(), Box<Fn(&())>) {}
34 fn g2<F>(_: F) where F: Fn(&(), fn(&())) {}
35 fn g3<F>(_: F) where F: for<'s> Fn(&'s (), Box<Fn(&())>) {}
36 fn g4<F>(_: F) where F: Fn(&(), for<'r> fn(&'r ())) {}
37
38 // Mixed
39 fn h1<F>(_: F) where F: Fn(&(), Box<Fn(&())>, &(), fn(&(), &())) {}
40 fn h2<F>(_: F) where F: for<'t0> Fn(&(), Box<Fn(&())>, &'t0 (), fn(&(), &())) {}