rust/tests/ui/span/issue-11925.rs

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

14 lines
300 B
Rust
Raw Normal View History

2022-07-30 05:37:48 +00:00
#![feature(unboxed_closures, tuple_trait)]
2022-07-30 05:37:48 +00:00
fn to_fn_once<A:std::marker::Tuple,F:FnOnce<A>>(f: F) -> F { f }
2015-01-08 02:53:58 +00:00
fn main() {
let r = {
let x: Box<_> = Box::new(42);
let f = to_fn_once(move|| &x); //~ ERROR cannot return reference to local data `x`
f()
};
drop(r);
}