summaryrefslogtreecommitdiffstats
path: root/tests/ui/regions/regions-params.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/regions/regions-params.rs')
-rw-r--r--tests/ui/regions/regions-params.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/ui/regions/regions-params.rs b/tests/ui/regions/regions-params.rs
new file mode 100644
index 000000000..04f3b8eaf
--- /dev/null
+++ b/tests/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);
+}