Add new error code tests
This commit is contained in:
parent
150599d01d
commit
37bf449de4
10 changed files with 160 additions and 0 deletions
19
src/test/compile-fail/E0528.rs
Normal file
19
src/test/compile-fail/E0528.rs
Normal file
|
@ -0,0 +1,19 @@
|
|||
// Copyright 2016 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.
|
||||
|
||||
#![feature(slice_patterns)]
|
||||
|
||||
fn main() {
|
||||
let r = &[1, 2];
|
||||
match r {
|
||||
&[a, b, c, rest..] => { //~ ERROR E0528
|
||||
}
|
||||
}
|
||||
}
|
19
src/test/compile-fail/E0529.rs
Normal file
19
src/test/compile-fail/E0529.rs
Normal file
|
@ -0,0 +1,19 @@
|
|||
// Copyright 2016 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.
|
||||
|
||||
#![feature(slice_patterns)]
|
||||
|
||||
fn main() {
|
||||
let r: f32 = 1.0;
|
||||
match r {
|
||||
[a, b] => { //~ ERROR E0529
|
||||
}
|
||||
}
|
||||
}
|
18
src/test/compile-fail/E0530.rs
Normal file
18
src/test/compile-fail/E0530.rs
Normal file
|
@ -0,0 +1,18 @@
|
|||
// Copyright 2016 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() {
|
||||
static TEST: i32 = 0;
|
||||
|
||||
let r: (i32, i32) = (0, 0);
|
||||
match r {
|
||||
TEST => {} //~ ERROR E0530
|
||||
}
|
||||
}
|
14
src/test/compile-fail/E0534.rs
Normal file
14
src/test/compile-fail/E0534.rs
Normal file
|
@ -0,0 +1,14 @@
|
|||
// Copyright 2016 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.
|
||||
|
||||
#[inline()] //~ ERROR E0534
|
||||
pub fn something() {}
|
||||
|
||||
fn main() {}
|
14
src/test/compile-fail/E0535.rs
Normal file
14
src/test/compile-fail/E0535.rs
Normal file
|
@ -0,0 +1,14 @@
|
|||
// Copyright 2016 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.
|
||||
|
||||
#[inline(unknown)] //~ ERROR E0535
|
||||
pub fn something() {}
|
||||
|
||||
fn main() {}
|
14
src/test/compile-fail/E0536.rs
Normal file
14
src/test/compile-fail/E0536.rs
Normal file
|
@ -0,0 +1,14 @@
|
|||
// Copyright 2016 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.
|
||||
|
||||
#[cfg(not())] //~ ERROR E0536
|
||||
pub fn something() {}
|
||||
|
||||
pub fn main() {}
|
14
src/test/compile-fail/E0537.rs
Normal file
14
src/test/compile-fail/E0537.rs
Normal file
|
@ -0,0 +1,14 @@
|
|||
// Copyright 2016 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.
|
||||
|
||||
#[cfg(unknown())] //~ ERROR E0537
|
||||
pub fn something() {}
|
||||
|
||||
pub fn main() {}
|
14
src/test/compile-fail/E0558.rs
Normal file
14
src/test/compile-fail/E0558.rs
Normal file
|
@ -0,0 +1,14 @@
|
|||
// Copyright 2016 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.
|
||||
|
||||
#[export_name] //~ ERROR E0558
|
||||
pub fn something() {}
|
||||
|
||||
fn main() {}
|
17
src/test/compile-fail/E0559.rs
Normal file
17
src/test/compile-fail/E0559.rs
Normal file
|
@ -0,0 +1,17 @@
|
|||
// Copyright 2016 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.
|
||||
|
||||
enum Field {
|
||||
Fool { x: u32 },
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let s = Field::Fool { joke: 0 }; //~ ERROR E0559
|
||||
}
|
17
src/test/compile-fail/E560.rs
Normal file
17
src/test/compile-fail/E560.rs
Normal file
|
@ -0,0 +1,17 @@
|
|||
// Copyright 2016 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.
|
||||
|
||||
struct Simba {
|
||||
mother: u32,
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let s = Simba { mother: 1, father: 0 }; //~ ERROR E0560
|
||||
}
|
Loading…
Add table
Reference in a new issue