2018-08-30 12:18:55 +00:00
|
|
|
//@ run-pass
|
2018-09-25 21:51:35 +00:00
|
|
|
#![allow(unused_parens)]
|
2012-09-18 22:52:21 +00:00
|
|
|
|
2015-03-22 20:13:15 +00:00
|
|
|
|
2015-03-26 00:06:52 +00:00
|
|
|
fn region_identity(x: &usize) -> &usize { x }
|
2012-04-01 21:28:30 +00:00
|
|
|
|
2015-01-02 22:32:54 +00:00
|
|
|
fn apply<T, F>(t: T, f: F) -> T where F: FnOnce(T) -> T { f(t) }
|
2012-04-01 21:28:30 +00:00
|
|
|
|
2015-03-26 00:06:52 +00:00
|
|
|
fn parameterized(x: &usize) -> usize {
|
2012-06-26 20:55:56 +00:00
|
|
|
let z = apply(x, ({|y|
|
2012-04-01 21:28:30 +00:00
|
|
|
region_identity(y)
|
2012-06-26 20:55:56 +00:00
|
|
|
}));
|
2012-04-01 21:28:30 +00:00
|
|
|
*z
|
|
|
|
}
|
|
|
|
|
2013-02-02 03:43:17 +00:00
|
|
|
pub fn main() {
|
2015-03-03 08:42:26 +00:00
|
|
|
let x = 3;
|
|
|
|
assert_eq!(parameterized(&x), 3);
|
2012-09-18 22:52:21 +00:00
|
|
|
}
|