diff options
Diffstat (limited to '')
-rw-r--r-- | src/test/ui/regions/regions-params.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/test/ui/regions/regions-params.rs b/src/test/ui/regions/regions-params.rs new file mode 100644 index 000000000..04f3b8eaf --- /dev/null +++ b/src/test/ui/regions/regions-params.rs @@ -0,0 +1,19 @@ +// run-pass +#![allow(unused_parens)] + + +fn region_identity(x: &usize) -> &usize { x } + +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); +} |