From b57b0e0f3a49a81c23f7af6cbd72a67fdf6b9574 Mon Sep 17 00:00:00 2001 From: "Felix S. Klock II" Date: Wed, 7 Jan 2015 23:03:22 +0100 Subject: [PATCH] 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. --- .../compile-fail/feature-gate-box-expr.rs | 23 +++++++++++++++++++ src/test/compile-fail/feature-gate-box-pat.rs | 14 +++++++++++ 2 files changed, 37 insertions(+) create mode 100644 src/test/compile-fail/feature-gate-box-expr.rs create mode 100644 src/test/compile-fail/feature-gate-box-pat.rs 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 or the MIT license +// , 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 or the MIT license +// , 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); +}