Suggest an appropriate token when encountering pub Ident<'a>

This commit is contained in:
Esteban Küber 2018-11-26 10:11:46 -08:00
parent 3dde9e1322
commit 0952856e6c
7 changed files with 75 additions and 11 deletions

View file

@ -0,0 +1,6 @@
pub foo<'a>(_s: &'a usize) -> bool { true }
//~^ ERROR missing `fn` for method definition
fn main() {
foo(2);
}

View file

@ -0,0 +1,12 @@
error: missing `fn` for method definition
--> $DIR/pub-ident-fn-with-lifetime.rs:1:4
|
LL | pub foo<'a>(_s: &'a usize) -> bool { true }
| ^^^
help: add `fn` here to parse `foo` as a public method
|
LL | pub fn foo<'a>(_s: &'a usize) -> bool { true }
| ^^
error: aborting due to previous error

View file

@ -0,0 +1,4 @@
pub S<'a> {
//~^ ERROR missing `struct` for struct definition
}
fn main() {}

View file

@ -0,0 +1,12 @@
error: missing `struct` for struct definition
--> $DIR/pub-ident-struct-with-lifetime.rs:1:4
|
LL | pub S<'a> {
| ^
help: add `struct` here to parse `S` as a public struct
|
LL | pub struct S<'a> {
| ^^^^^^
error: aborting due to previous error

View file

@ -0,0 +1,5 @@
fn main() {
}
pub foo<'a>
//~^ ERROR missing `fn` or `struct` for method or struct definition

View file

@ -0,0 +1,8 @@
error: missing `fn` or `struct` for method or struct definition
--> $DIR/pub-ident-with-lifetime-incomplete.rs:4:4
|
LL | pub foo<'a>
| ^^^
error: aborting due to previous error