]> git.lizzy.rs Git - rust.git/blob - tests/ui/regions/issue-6157.rs
internally change regions to be covariant
[rust.git] / tests / ui / regions / issue-6157.rs
1 // run-pass
2 // pretty-expanded FIXME #23616
3
4 pub trait OpInt { fn call(&mut self, _: isize, _: isize) -> isize; }
5
6 impl<F> OpInt for F where F: FnMut(isize, isize) -> isize {
7     fn call(&mut self, a:isize, b:isize) -> isize {
8         (*self)(a, b)
9     }
10 }
11
12 fn squarei<'a>(x: isize, op: &'a mut dyn OpInt) -> isize { op.call(x, x) }
13
14 fn muli(x:isize, y:isize) -> isize { x * y }
15
16 pub fn main() {
17     let mut f = |x, y| muli(x, y);
18     {
19         let g = &mut f;
20         let h = g as &mut dyn OpInt;
21         squarei(3, h);
22     }
23 }