2 // Test that we are able to handle the relationships between free
3 // regions bound in a closure callback.
6 struct MyCx<'short, 'long: 'short> {
11 impl<'short, 'long> MyCx<'short, 'long> {
12 fn short(self) -> &'short u32 { self.short }
13 fn long(self) -> &'long u32 { self.long }
14 fn set_short(&mut self, v: &'short u32) { self.short = v; }
17 fn with<F, R>(op: F) -> R
19 F: for<'short, 'long> FnOnce(MyCx<'short, 'long>) -> R,
29 // For this to type-check, we need to be able to deduce that
30 // the lifetime of `l` can be `'short`, even though it has
31 // input from `'long`.
32 let l = if true { cx.long() } else { cx.short() };