Auto merge of #41282 - arielb1:missing-impl-item, r=petrochenkov
libsyntax/parse: fix missing kind error reporting Fixes #41161. Fixes #41239.
This commit is contained in:
commit
235fe8313f
9 changed files with 191 additions and 81 deletions
|
|
@ -8,8 +8,20 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
impl X {
|
||||
Y
|
||||
}
|
||||
|
||||
struct S;
|
||||
|
||||
trait X {
|
||||
X() {}
|
||||
fn xxx() { ### }
|
||||
L = M;
|
||||
Z = { 2 + 3 };
|
||||
::Y ();
|
||||
}
|
||||
|
||||
impl S {
|
||||
pub hello_method(&self) {
|
||||
println!("Hello");
|
||||
|
|
|
|||
|
|
@ -1,8 +1,68 @@
|
|||
error: missing `fn` for method declaration
|
||||
--> $DIR/issue-40006.rs:14:8
|
||||
error: missing `fn`, `type`, or `const` for impl-item declaration
|
||||
--> $DIR/issue-40006.rs:11:9
|
||||
|
|
||||
14 | pub hello_method(&self) {
|
||||
| ^ missing `fn`
|
||||
11 | impl X {
|
||||
| _________^ starting here...
|
||||
12 | | Y
|
||||
| |____^ ...ending here: missing `fn`, `type`, or `const`
|
||||
|
||||
error: missing `fn`, `type`, or `const` for trait-item declaration
|
||||
--> $DIR/issue-40006.rs:17:10
|
||||
|
|
||||
17 | trait X {
|
||||
| __________^ starting here...
|
||||
18 | | X() {}
|
||||
| |____^ ...ending here: missing `fn`, `type`, or `const`
|
||||
|
||||
error: expected `[`, found `#`
|
||||
--> $DIR/issue-40006.rs:19:17
|
||||
|
|
||||
19 | fn xxx() { ### }
|
||||
| ^
|
||||
|
||||
error: missing `fn`, `type`, or `const` for trait-item declaration
|
||||
--> $DIR/issue-40006.rs:19:21
|
||||
|
|
||||
19 | fn xxx() { ### }
|
||||
| _____________________^ starting here...
|
||||
20 | | L = M;
|
||||
| |____^ ...ending here: missing `fn`, `type`, or `const`
|
||||
|
||||
error: missing `fn`, `type`, or `const` for trait-item declaration
|
||||
--> $DIR/issue-40006.rs:20:11
|
||||
|
|
||||
20 | L = M;
|
||||
| ___________^ starting here...
|
||||
21 | | Z = { 2 + 3 };
|
||||
| |____^ ...ending here: missing `fn`, `type`, or `const`
|
||||
|
||||
error: expected one of `const`, `extern`, `fn`, `type`, `unsafe`, or `}`, found `;`
|
||||
--> $DIR/issue-40006.rs:21:18
|
||||
|
|
||||
21 | Z = { 2 + 3 };
|
||||
| ^ expected one of `const`, `extern`, `fn`, `type`, `unsafe`, or `}` here
|
||||
|
||||
error: expected one of `!` or `::`, found `(`
|
||||
--> $DIR/issue-40006.rs:22:9
|
||||
|
|
||||
22 | ::Y ();
|
||||
| -^ unexpected token
|
||||
| |
|
||||
| expected one of `!` or `::` here
|
||||
|
||||
error: missing `fn`, `type`, or `const` for impl-item declaration
|
||||
--> $DIR/issue-40006.rs:26:8
|
||||
|
|
||||
26 | pub hello_method(&self) {
|
||||
| ^ missing `fn`, `type`, or `const`
|
||||
|
||||
error[E0038]: the trait `X` cannot be made into an object
|
||||
--> $DIR/issue-40006.rs:11:6
|
||||
|
|
||||
11 | impl X {
|
||||
| ^ the trait `X` cannot be made into an object
|
||||
|
|
||||
= note: method `xxx` has no receiver
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -6,5 +6,13 @@ error: expected one of `(`, `const`, `default`, `extern`, `fn`, `type`, or `unsa
|
|||
13 | }
|
||||
| ^ unexpected token
|
||||
|
||||
error: aborting due to previous error
|
||||
error[E0412]: cannot find type `S` in this scope
|
||||
--> $DIR/issue-41155.rs:11:6
|
||||
|
|
||||
11 | impl S {
|
||||
| ^ not found in this scope
|
||||
|
||||
error: main function not found
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue