Clean up and add extra tests

This commit is contained in:
varkor 2018-08-11 21:25:48 +01:00
parent 49e9c5fe90
commit 5c814e2e4e
6 changed files with 26 additions and 30 deletions

View file

@ -8,12 +8,17 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
trait Foo {
fn foo((x, y): (i32, i32)); //~ ERROR patterns aren't allowed in trait methods
}
#[derive(Clone, Copy)]
struct S;
trait Bar {
fn bar((x, y): (i32, i32)) {} //~ ERROR patterns aren't allowed in trait methods
trait T {
fn foo((x, y): (i32, i32)); //~ ERROR patterns aren't allowed in methods without bodies
fn bar((x, y): (i32, i32)) {} //~ ERROR patterns aren't allowed in methods without bodies
fn f(&ident: &S) {} // ok
fn g(&&ident: &&S) {} // ok
fn h(mut ident: S) {} // ok
}
fn main() {}

View file

@ -1,21 +1,21 @@
error[E0642]: patterns aren't allowed in trait methods
--> $DIR/E0642.rs:12:12
error[E0642]: patterns aren't allowed in methods without bodies
--> $DIR/E0642.rs:15:12
|
LL | fn foo((x, y): (i32, i32)); //~ ERROR patterns aren't allowed in trait methods
LL | fn foo((x, y): (i32, i32)); //~ ERROR patterns aren't allowed in methods without bodies
| ^^^^^^
help: give this argument a name or use an underscore to ignore it
|
LL | fn foo(_: (i32, i32)); //~ ERROR patterns aren't allowed in trait methods
LL | fn foo(_: (i32, i32)); //~ ERROR patterns aren't allowed in methods without bodies
| ^
error[E0642]: patterns aren't allowed in trait methods
--> $DIR/E0642.rs:16:12
error[E0642]: patterns aren't allowed in methods without bodies
--> $DIR/E0642.rs:17:12
|
LL | fn bar((x, y): (i32, i32)) {} //~ ERROR patterns aren't allowed in trait methods
LL | fn bar((x, y): (i32, i32)) {} //~ ERROR patterns aren't allowed in methods without bodies
| ^^^^^^
help: give this argument a name or use an underscore to ignore it
|
LL | fn bar(_: (i32, i32)) {} //~ ERROR patterns aren't allowed in trait methods
LL | fn bar(_: (i32, i32)) {} //~ ERROR patterns aren't allowed in methods without bodies
| ^
error: aborting due to 2 previous errors