about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFelix S. Klock II <pnkfelix@pnkfx.org>2015-01-07 23:03:22 +0100
committerFelix S. Klock II <pnkfelix@pnkfx.org>2015-01-08 00:41:49 +0100
commitb57b0e0f3a49a81c23f7af6cbd72a67fdf6b9574 (patch)
tree4f93f88f7deda9b9e0778c2418df011cf2c79766
parentc52486df313c6971f908fbdc48420eb1ed23f8f1 (diff)
downloadrust-b57b0e0f3a49a81c23f7af6cbd72a67fdf6b9574.tar.gz
rust-b57b0e0f3a49a81c23f7af6cbd72a67fdf6b9574.zip
Test that box syntax, both in expressions and patterns, is caught by
feature gate net.

fix typo in my feature-gate-box-expr.rs test.
-rw-r--r--src/test/compile-fail/feature-gate-box-expr.rs23
-rw-r--r--src/test/compile-fail/feature-gate-box-pat.rs14
2 files changed, 37 insertions, 0 deletions
diff --git a/src/test/compile-fail/feature-gate-box-expr.rs b/src/test/compile-fail/feature-gate-box-expr.rs
new file mode 100644
index 00000000000..bc7a70471cd
--- /dev/null
+++ b/src/test/compile-fail/feature-gate-box-expr.rs
@@ -0,0 +1,23 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+    use std::boxed::HEAP;
+
+    let x = box 'c'; //~ ERROR box expression syntax is experimental in alpha release
+    println!("x: {}", x);
+
+    let x = box () 'c'; //~ ERROR box expression syntax is experimental in alpha release
+    println!("x: {}", x);
+
+    let x = box (HEAP) 'c'; //~ ERROR box expression syntax is experimental in alpha release
+    println!("x: {}", x);
+}
+
diff --git a/src/test/compile-fail/feature-gate-box-pat.rs b/src/test/compile-fail/feature-gate-box-pat.rs
new file mode 100644
index 00000000000..b36bc22b9dc
--- /dev/null
+++ b/src/test/compile-fail/feature-gate-box-pat.rs
@@ -0,0 +1,14 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+    let box x = Box::new('c'); //~ ERROR box pattern syntax is experimental in alpha release
+    println!("x: {}", x);
+}