diff options
Diffstat (limited to 'tests/ui/closures/closure-bounds-static-cant-capture-borrowed.rs')
-rw-r--r-- | tests/ui/closures/closure-bounds-static-cant-capture-borrowed.rs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/ui/closures/closure-bounds-static-cant-capture-borrowed.rs b/tests/ui/closures/closure-bounds-static-cant-capture-borrowed.rs new file mode 100644 index 000000000..7327d8256 --- /dev/null +++ b/tests/ui/closures/closure-bounds-static-cant-capture-borrowed.rs @@ -0,0 +1,13 @@ +fn bar<F>(blk: F) where F: FnOnce() + 'static { +} + +fn foo(x: &()) { + bar(|| { + //~^ ERROR borrowed data escapes + //~| ERROR closure may outlive + let _ = x; + }) +} + +fn main() { +} |