diff options
Diffstat (limited to 'tests/compile-fail/array.rs')
-rw-r--r-- | tests/compile-fail/array.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/compile-fail/array.rs b/tests/compile-fail/array.rs new file mode 100644 index 0000000..c5492e8 --- /dev/null +++ b/tests/compile-fail/array.rs @@ -0,0 +1,14 @@ +extern crate clint; + +use clint::cs::Locker; +use clint::HandlerArray; + +fn main() { + let mut hs = HandlerArray::new(); + hs.with_overrides(|new_hs| nested(new_hs)); +} + +fn nested(hs: &HandlerArray) { + let mut c = || println!("Short-lived closure."); + hs.register(0, &mut c) //~ ERROR `c` does not live long enough +} |