Files
rust/src/test/ui/closures/closure-bounds-static-cant-capture-borrowed.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

19 lines
429 B
Rust
Raw Normal View History

2022-05-21 14:22:42 -04:00
// ignore-compare-mode-nll
// revisions: base nll
// [nll]compile-flags: -Zborrowck=mir
2015-01-03 10:45:00 -05:00
fn bar<F>(blk: F) where F: FnOnce() + 'static {
}
fn foo(x: &()) {
bar(|| {
2022-05-21 14:22:42 -04:00
//[base]~^ ERROR `x` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement [E0759]
//[nll]~^^ ERROR borrowed data escapes
//[nll]~| ERROR closure may outlive
let _ = x;
})
}
fn main() {
}