]> git.lizzy.rs Git - rust.git/blob - src/test/ui/regions/regions-ref-in-fn-arg.rs
Rollup merge of #97317 - GuillaumeGomez:gui-settings-text-click, r=jsha
[rust.git] / src / test / ui / regions / regions-ref-in-fn-arg.rs
1 #![feature(box_patterns)]
2
3
4 fn arg_item(box ref x: Box<isize>) -> &'static isize {
5     x //~ ERROR cannot return value referencing function parameter
6 }
7
8 fn with<R, F>(f: F) -> R where F: FnOnce(Box<isize>) -> R { f(Box::new(3)) }
9
10 fn arg_closure() -> &'static isize {
11     with(|box ref x| x) //~ ERROR cannot return value referencing function parameter
12 }
13
14 fn main() {}