File tree Expand file tree Collapse file tree 21 files changed +404
-0
lines changed Expand file tree Collapse file tree 21 files changed +404
-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 Foo ( u8 ) ;
12+
13+ impl Foo {
14+ fn bar ( & self ) -> bool { self . 0 > 5 }
15+ fn bar ( ) { } //~ ERROR E0201
16+ }
17+
18+ trait Baz {
19+ type Quux ;
20+ fn baz ( & self ) -> bool ;
21+ }
22+
23+ impl Baz for Foo {
24+ type Quux = u32 ;
25+
26+ fn baz ( & self ) -> bool { true }
27+ fn baz ( & self ) -> bool { self . 0 > 5 } //~ ERROR E0201
28+ type Quux = u32 ; //~ ERROR E0201
29+ }
30+
31+ fn main ( ) {
32+ }
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 Foo {
12+ foo : Vec < u32 > ,
13+ }
14+
15+ impl Copy for Foo { } //~ ERROR E0204
16+
17+ #[ derive( Copy ) ] //~ ERROR E0204
18+ struct Foo2 < ' a > {
19+ ty : & ' a mut bool ,
20+ }
21+
22+ fn main ( ) {
23+ }
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 Foo {
12+ Bar ( Vec < u32 > ) ,
13+ Baz ,
14+ }
15+
16+ impl Copy for Foo { } //~ ERROR E0205
17+
18+ #[ derive( Copy ) ] //~ ERROR E0205
19+ enum Foo2 < ' a > {
20+ Bar ( & ' a mut bool ) ,
21+ Baz ,
22+ }
23+
24+ fn main ( ) {
25+ }
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+ type Foo = i32 ;
12+
13+ impl Copy for Foo { } //~ ERROR E0206
14+ //~^ ERROR E0117
15+
16+ #[ derive( Copy , Clone ) ]
17+ struct Bar ;
18+
19+ impl Copy for & ' static Bar { } //~ ERROR E0206
20+
21+ fn main ( ) {
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+ struct Foo ;
12+
13+ impl < T : Default > Foo { //~ ERROR E0207
14+ fn get ( & self ) -> T {
15+ <T as Default >:: default ( )
16+ }
17+ }
18+
19+ fn main ( ) {
20+ }
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 v: Vec ( & str ) = vec ! [ "foo" ] ; //~ ERROR E0214
13+ }
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 Trait {
12+ type Bar ;
13+ }
14+
15+ type Foo = Trait < F =i32 > ; //~ ERROR E0220
16+ //~^ ERROR E0191
17+
18+ fn main ( ) {
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+ trait T1 { }
12+ trait T2 { }
13+
14+ trait Foo {
15+ type A : T1 ;
16+ }
17+
18+ trait Bar : Foo {
19+ type A : T2 ;
20+ fn do_something ( ) {
21+ let _: Self :: A ; //~ ERROR E0221
22+ }
23+ }
24+
25+ fn main ( ) {
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+ trait MyTrait { type X ; }
12+
13+ fn main ( ) {
14+ let foo: MyTrait :: X ; //~ ERROR E0223
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+ fn main ( ) {
12+ let _: Box < std:: io:: Read + std:: io:: Write > ; //~ ERROR E0225
13+ }
You can’t perform that action at this time.
0 commit comments