File tree Expand file tree Collapse file tree 6 files changed +121
-0
lines changed Expand file tree Collapse file tree 6 files changed +121
-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+ struct Dog {
12+ name : String ,
13+ age : u32 ,
14+ }
15+
16+ fn main ( ) {
17+ let d = Dog { name : "Rusty" . to_string ( ) , age : 8 } ;
18+
19+ match d {
20+ Dog { age : x } => { } //~ ERROR E0027
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 s = "hoho" ;
13+
14+ match s {
15+ "hello" ... "world" => { } //~ ERROR E0029
16+ _ => { }
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+
12+ fn main ( ) {
13+ match 5u32 {
14+ 1000 ... 5 => { } //~ ERROR E0030
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+ trait SomeTrait {
12+ fn foo ( ) ;
13+ }
14+
15+ fn main ( ) {
16+ let trait_obj: & SomeTrait = SomeTrait ; //~ ERROR E0425
17+ //~^ ERROR E0038
18+ let & invalid = trait_obj; //~ ERROR E0033
19+ }
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+ struct Test ;
12+
13+ trait Trait1 {
14+ fn foo ( ) ;
15+ }
16+
17+ trait Trait2 {
18+ fn foo ( ) ;
19+ }
20+
21+ impl Trait1 for Test { fn foo ( ) { } }
22+ impl Trait2 for Test { fn foo ( ) { } }
23+
24+ fn main ( ) {
25+ Test :: foo ( ) //~ ERROR E0034
26+ }
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+ struct Test ;
12+
13+ impl Test {
14+ fn method ( & self ) { }
15+ }
16+
17+ fn main ( ) {
18+ let x = Test ;
19+ x. method :: < i32 > ( ) ; //~ ERROR E0035
20+ }
You can’t perform that action at this time.
0 commit comments