diff options
Diffstat (limited to 'src/test/ui/regions/issue-6157.rs')
-rw-r--r-- | src/test/ui/regions/issue-6157.rs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/test/ui/regions/issue-6157.rs b/src/test/ui/regions/issue-6157.rs new file mode 100644 index 000000000..b7a44ed86 --- /dev/null +++ b/src/test/ui/regions/issue-6157.rs @@ -0,0 +1,23 @@ +// run-pass +// pretty-expanded FIXME #23616 + +pub trait OpInt { fn call(&mut self, _: isize, _: isize) -> isize; } + +impl<F> OpInt for F where F: FnMut(isize, isize) -> isize { + fn call(&mut self, a:isize, b:isize) -> isize { + (*self)(a, b) + } +} + +fn squarei<'a>(x: isize, op: &'a mut dyn OpInt) -> isize { op.call(x, x) } + +fn muli(x:isize, y:isize) -> isize { x * y } + +pub fn main() { + let mut f = |x, y| muli(x, y); + { + let g = &mut f; + let h = g as &mut dyn OpInt; + squarei(3, h); + } +} |