File tree Expand file tree Collapse file tree 13 files changed +242
-0
lines changed Expand file tree Collapse file tree 13 files changed +242
-0
lines changed Original file line number Diff line number Diff line change 1+ // Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2+ // file at the top-level directory of this distribution and at
3+ // http://rust-lang.org/COPYRIGHT.
4+ //
5+ // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+ // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+ // option. This file may not be copied, modified, or distributed
9+ // except according to those terms.
10+
11+ fn main ( ) {
12+ let foo = Some ( 1 ) ;
13+ match foo {
14+ Some ( bar) => { /* ... */ }
15+ None => { /* ... */ }
16+ _ => { /* ... */ } //~ ERROR E0001
17+ }
18+ }
Original file line number Diff line number Diff line change 1+ // Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2+ // file at the top-level directory of this distribution and at
3+ // http://rust-lang.org/COPYRIGHT.
4+ //
5+ // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+ // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+ // option. This file may not be copied, modified, or distributed
9+ // except according to those terms.
10+
11+ fn main ( ) {
12+ let x = Some ( 1 ) ;
13+
14+ match x { } //~ ERROR E0002
15+ }
Original file line number Diff line number Diff line change 1+ // Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2+ // file at the top-level directory of this distribution and at
3+ // http://rust-lang.org/COPYRIGHT.
4+ //
5+ // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+ // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+ // option. This file may not be copied, modified, or distributed
9+ // except according to those terms.
10+
11+ enum Terminator {
12+ HastaLaVistaBaby ,
13+ TalkToMyHand ,
14+ }
15+
16+ fn main ( ) {
17+ let x = Terminator :: HastaLaVistaBaby ;
18+
19+ match x { //~ ERROR E0004
20+ Terminator :: TalkToMyHand => { }
21+ }
22+ }
Original file line number Diff line number Diff line change 1+ // Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2+ // file at the top-level directory of this distribution and at
3+ // http://rust-lang.org/COPYRIGHT.
4+ //
5+ // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+ // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+ // option. This file may not be copied, modified, or distributed
9+ // except according to those terms.
10+
11+ fn main ( ) {
12+ let x = Some ( 1 ) ;
13+ let Some ( y) = x; //~ ERROR E0005
14+ }
Original file line number Diff line number Diff line change 1+ // Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2+ // file at the top-level directory of this distribution and at
3+ // http://rust-lang.org/COPYRIGHT.
4+ //
5+ // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+ // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+ // option. This file may not be copied, modified, or distributed
9+ // except according to those terms.
10+
11+ fn main ( ) {
12+ let x = Some ( "s" . to_string ( ) ) ;
13+ match x {
14+ op_string @ Some ( s) => { } , //~ ERROR E0007
15+ //~| ERROR E0303
16+ None => { } ,
17+ }
18+ }
Original file line number Diff line number Diff line change 1+ // Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2+ // file at the top-level directory of this distribution and at
3+ // http://rust-lang.org/COPYRIGHT.
4+ //
5+ // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+ // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+ // option. This file may not be copied, modified, or distributed
9+ // except according to those terms.
10+
11+ fn main ( ) {
12+ match Some ( "hi" . to_string ( ) ) {
13+ Some ( s) if s. len ( ) == 0 => { } , //~ ERROR E0008
14+ _ => { } ,
15+ }
16+ }
Original file line number Diff line number Diff line change 1+ // Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2+ // file at the top-level directory of this distribution and at
3+ // http://rust-lang.org/COPYRIGHT.
4+ //
5+ // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+ // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+ // option. This file may not be copied, modified, or distributed
9+ // except according to those terms.
10+
11+ fn main ( ) {
12+ struct X { x : ( ) , }
13+ let x = Some ( ( X { x : ( ) } , X { x : ( ) } ) ) ;
14+ match x {
15+ Some ( ( y, ref z) ) => { } , //~ ERROR E0009
16+ None => panic ! ( )
17+ }
18+ }
Original file line number Diff line number Diff line change 1+ // Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2+ // file at the top-level directory of this distribution and at
3+ // http://rust-lang.org/COPYRIGHT.
4+ //
5+ // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+ // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+ // option. This file may not be copied, modified, or distributed
9+ // except according to those terms.
10+
11+ #![ feature( box_syntax) ]
12+
13+ const CON : Box < i32 > = box 0 ; //~ ERROR E0010
14+
15+ fn main ( ) { }
Original file line number Diff line number Diff line change 1+ // Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2+ // file at the top-level directory of this distribution and at
3+ // http://rust-lang.org/COPYRIGHT.
4+ //
5+ // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+ // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+ // option. This file may not be copied, modified, or distributed
9+ // except according to those terms.
10+
11+ static X : i32 = 1 ;
12+ const C : i32 = 2 ;
13+
14+ const CR : & ' static mut i32 = & mut C ; //~ ERROR E0017
15+ //~| ERROR E0017
16+ static STATIC_REF : & ' static mut i32 = & mut X ; //~ ERROR E0017
17+ //~| ERROR E0017
18+ //~| ERROR E0388
19+ static CONST_REF : & ' static mut i32 = & mut C ; //~ ERROR E0017
20+ //~| ERROR E0017
21+
22+ fn main ( ) { }
Original file line number Diff line number Diff line change 1+ // Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2+ // file at the top-level directory of this distribution and at
3+ // http://rust-lang.org/COPYRIGHT.
4+ //
5+ // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+ // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+ // option. This file may not be copied, modified, or distributed
9+ // except according to those terms.
10+
11+ enum Fruit {
12+ Apple ( String , String ) ,
13+ Pear ( u32 ) ,
14+ }
15+
16+ fn main ( ) {
17+ let x = Fruit :: Apple ( String :: new ( ) , String :: new ( ) ) ;
18+ match x {
19+ Fruit :: Apple ( a) => { } , //~ ERROR E0023
20+ Fruit :: Apple ( a, b, c) => { } , //~ ERROR E0023
21+ }
22+ }
You can’t perform that action at this time.
0 commit comments