summaryrefslogtreecommitdiffstats
path: root/tests/ui/regions/regions-ref-in-fn-arg.rs
blob: 3df529c9f0dae8909d60e14eda1579abdab6edb4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#![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() {}