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 // compile-flags:-Zborrowck=mir -Zverbose
14 #![feature(dyn_trait)]
15 #![feature(rustc_attrs)]
19 // Invoke in such a way that the callee knows:
23 // and it must prove that `T: 'x`. Callee passes along `T: 'a`.
24 fn twice<'a, F, T>(v: Cell<&'a ()>, value: T, mut f: F)
26 F: for<'x> FnMut(Option<Cell<&'a &'x ()>>, &T),
33 fn generic<T>(value: T) {
34 let cell = Cell::new(&());
35 twice(cell, value, |a, b| invoke(a, b));
36 //~^ WARNING not reporting region error
38 // This error from the old region solver looks bogus.
42 fn generic_fail<'a, T>(cell: Cell<&'a ()>, value: T) {
43 twice(cell, value, |a, b| invoke(a, b));
44 //~^ WARNING not reporting region error
45 //~| WARNING not reporting region error
46 //~| ERROR the parameter type `T` may not live long enough
49 fn invoke<'a, 'x, T>(x: Option<Cell<&'x &'a ()>>, y: &T)