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.
This commit is contained in:
parent
c52486df31
commit
b57b0e0f3a
2 changed files with 37 additions and 0 deletions
23
src/test/compile-fail/feature-gate-box-expr.rs
Normal file
23
src/test/compile-fail/feature-gate-box-expr.rs
Normal file
|
@ -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
src/test/compile-fail/feature-gate-box-pat.rs
Normal file
14
src/test/compile-fail/feature-gate-box-pat.rs
Normal file
|
@ -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);
|
||||
}
|
Loading…
Add table
Reference in a new issue