1 // Copyright 2016 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.
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.
11 // Test that we give the generic E0495 when one of the free regions is
12 // bound in a closure (rather than suggesting a change to the signature
13 // of the closure, which is not specified in `foo` but rather in `invoke`).
15 // FIXME - This might be better as a UI test, but the finer details
16 // of the error seem to vary on different machines.
17 fn invoke<'a, F>(x: &'a i32, f: F) -> &'a i32
18 where F: FnOnce(&'a i32, &i32) -> &'a i32
24 fn foo<'a>(x: &'a i32) {
25 invoke(&x, |a, b| if a > b { a } else { b }); //~ ERROR E0495