rust/tests/ui/regions/regions-ref-in-fn-arg.rs
2023-01-11 09:32:08 +00:00

15 lines
369 B
Rust

#![feature(box_patterns)]
fn arg_item(box ref x: Box<isize>) -> &'static isize {
x //~ ERROR cannot return value referencing function parameter
}
fn with<R, F>(f: F) -> R where F: FnOnce(Box<isize>) -> R { f(Box::new(3)) }
fn arg_closure() -> &'static isize {
with(|box ref x| x) //~ ERROR cannot return value referencing function parameter
}
fn main() {}