Skip to content

Commit

Permalink
Test that box syntax, both in expressions and patterns, is caught by
Browse files Browse the repository at this point in the history
feature gate net.

fix typo in my feature-gate-box-expr.rs test.
  • Loading branch information
pnkfelix committed Jan 7, 2015
1 parent c52486d commit b57b0e0
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
23 changes: 23 additions & 0 deletions 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);
}

14 changes: 14 additions & 0 deletions 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);
}

0 comments on commit b57b0e0

Please sign in to comment.