rust/tests/ui/regions/regions-params.rs

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

20 lines
336 B
Rust
Raw Normal View History

//@ run-pass
#![allow(unused_parens)]
fn region_identity(x: &usize) -> &usize { x }
2015-01-02 22:32:54 +00:00
fn apply<T, F>(t: T, f: F) -> T where F: FnOnce(T) -> T { f(t) }
fn parameterized(x: &usize) -> usize {
let z = apply(x, ({|y|
region_identity(y)
}));
*z
}
pub fn main() {
let x = 3;
assert_eq!(parameterized(&x), 3);
}