Rely on regular "expected"/"found" parser error for fn
This commit is contained in:
parent
07a63e6d1f
commit
040f568815
15 changed files with 36 additions and 31 deletions
|
|
@ -1,4 +1,4 @@
|
|||
fn foo(a: [0; 1]) {} //~ ERROR expected type, found `0`
|
||||
//~| ERROR expected `;` or `{`, found `]`
|
||||
//~| ERROR expected one of `)`, `,`, `->`, `;`, `where`, or `{`, found `]`
|
||||
|
||||
fn main() {}
|
||||
|
|
|
|||
|
|
@ -4,11 +4,11 @@ error: expected type, found `0`
|
|||
LL | fn foo(a: [0; 1]) {}
|
||||
| ^ expected type
|
||||
|
||||
error: expected `;` or `{`, found `]`
|
||||
error: expected one of `)`, `,`, `->`, `;`, `where`, or `{`, found `]`
|
||||
--> $DIR/issue-39616.rs:1:16
|
||||
|
|
||||
LL | fn foo(a: [0; 1]) {}
|
||||
| ^ expected `;` or `{`
|
||||
| ^ expected one of `)`, `,`, `->`, `;`, `where`, or `{`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ impl A {
|
|||
//~^ ERROR cannot find type `A` in this scope
|
||||
fn b(self>
|
||||
//~^ ERROR expected one of `)`, `,`, or `:`, found `>`
|
||||
//~| ERROR expected `;` or `{`, found `>`
|
||||
//~| ERROR expected one of `->`, `;`, `where`, or `{`, found `>`
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
|
|
|||
|
|
@ -6,14 +6,14 @@ LL | fn b(self>
|
|||
| |
|
||||
| unclosed delimiter
|
||||
|
||||
error: expected `;` or `{`, found `>`
|
||||
error: expected one of `->`, `;`, `where`, or `{`, found `>`
|
||||
--> $DIR/issue-58856-1.rs:3:14
|
||||
|
|
||||
LL | impl A {
|
||||
| - while parsing this item list starting here
|
||||
LL |
|
||||
LL | fn b(self>
|
||||
| ^ expected `;` or `{`
|
||||
| ^ expected one of `->`, `;`, `where`, or `{`
|
||||
...
|
||||
LL | }
|
||||
| - the item list ends here
|
||||
|
|
|
|||
5
src/test/ui/parser/fn-colon-return-type.rs
Normal file
5
src/test/ui/parser/fn-colon-return-type.rs
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
fn foo(x: i32): i32 { //~ ERROR expected one of `->`, `;`, `where`, or `{`, found `:`
|
||||
x
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
8
src/test/ui/parser/fn-colon-return-type.stderr
Normal file
8
src/test/ui/parser/fn-colon-return-type.stderr
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
error: expected one of `->`, `;`, `where`, or `{`, found `:`
|
||||
--> $DIR/fn-colon-return-type.rs:1:15
|
||||
|
|
||||
LL | fn foo(x: i32): i32 {
|
||||
| ^ expected one of `->`, `;`, `where`, or `{`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
@ -3,6 +3,6 @@
|
|||
// expected one of ..., `>`, ... found `>`
|
||||
|
||||
fn foo() -> Vec<usize>> {
|
||||
//~^ ERROR expected `;` or `{`, found `>`
|
||||
//~^ ERROR expected one of `!`, `+`, `::`, `;`, `where`, or `{`, found `>`
|
||||
Vec::new()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
error: expected `;` or `{`, found `>`
|
||||
error: expected one of `!`, `+`, `::`, `;`, `where`, or `{`, found `>`
|
||||
--> $DIR/issue-24780.rs:5:23
|
||||
|
|
||||
LL | fn foo() -> Vec<usize>> {
|
||||
| ^ expected `;` or `{`
|
||||
| ^ expected one of `!`, `+`, `::`, `;`, `where`, or `{`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
trait Foo { fn a() } //~ ERROR expected `;` or `{`, found `}`
|
||||
trait Foo { fn a() } //~ ERROR expected one of `->`, `;`, `where`, or `{`, found `}`
|
||||
|
||||
fn main() {}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
error: expected `;` or `{`, found `}`
|
||||
error: expected one of `->`, `;`, `where`, or `{`, found `}`
|
||||
--> $DIR/issue-6610.rs:1:20
|
||||
|
|
||||
LL | trait Foo { fn a() }
|
||||
| - ^
|
||||
| | |
|
||||
| | expected `;` or `{`
|
||||
| | expected one of `->`, `;`, `where`, or `{`
|
||||
| | the item list ends here
|
||||
| while parsing this item list starting here
|
||||
|
||||
|
|
|
|||
|
|
@ -22,11 +22,11 @@ error: expected one of `:` or `|`, found `)`
|
|||
LL | fn main((ؼ
|
||||
| ^ expected one of `:` or `|`
|
||||
|
||||
error: expected `;` or `{`, found `<eof>`
|
||||
error: expected one of `->`, `;`, `where`, or `{`, found `<eof>`
|
||||
--> $DIR/missing_right_paren.rs:3:11
|
||||
|
|
||||
LL | fn main((ؼ
|
||||
| ^ expected `;` or `{`
|
||||
| ^ expected one of `->`, `;`, `where`, or `{`
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
// error-pattern: lt
|
||||
|
||||
fn f(a: isize, b: isize) : lt(a, b) { }
|
||||
//~^ ERROR expected one of `->`, `;`, `where`, or `{`, found `:`
|
||||
|
||||
fn lt(a: isize, b: isize) { }
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
error: expected `;` or `{`, found `:`
|
||||
--> $DIR/not-a-pred.rs:3:26
|
||||
error: expected one of `->`, `;`, `where`, or `{`, found `:`
|
||||
--> $DIR/not-a-pred.rs:1:26
|
||||
|
|
||||
LL | fn f(a: isize, b: isize) : lt(a, b) { }
|
||||
| ^ expected `;` or `{`
|
||||
| ^ expected one of `->`, `;`, `where`, or `{`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue