Talk about gen fn
in diagnostics about gen fn
This commit is contained in:
parent
91bbdd927a
commit
745c600617
5 changed files with 8 additions and 8 deletions
|
@ -278,8 +278,8 @@ parse_found_expr_would_be_stmt = expected expression, found `{$token}`
|
||||||
parse_function_body_equals_expr = function body cannot be `= expression;`
|
parse_function_body_equals_expr = function body cannot be `= expression;`
|
||||||
.suggestion = surround the expression with `{"{"}` and `{"}"}` instead of `=` and `;`
|
.suggestion = surround the expression with `{"{"}` and `{"}"}` instead of `=` and `;`
|
||||||
|
|
||||||
parse_gen_block = `gen` blocks are not yet implemented
|
parse_gen_fn = `gen` functions are not yet implemented
|
||||||
.help = only the keyword is reserved for now
|
.help = for now you can use `gen {"{}"}` blocks and return `impl Iterator` instead
|
||||||
|
|
||||||
parse_generic_args_in_pat_require_turbofish_syntax = generic args in patterns require the turbofish syntax
|
parse_generic_args_in_pat_require_turbofish_syntax = generic args in patterns require the turbofish syntax
|
||||||
|
|
||||||
|
|
|
@ -521,9 +521,9 @@ pub(crate) struct CatchAfterTry {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Diagnostic)]
|
#[derive(Diagnostic)]
|
||||||
#[diag(parse_gen_block)]
|
#[diag(parse_gen_fn)]
|
||||||
#[help]
|
#[help]
|
||||||
pub(crate) struct GenBlock {
|
pub(crate) struct GenFn {
|
||||||
#[primary_span]
|
#[primary_span]
|
||||||
pub span: Span,
|
pub span: Span,
|
||||||
}
|
}
|
||||||
|
|
|
@ -2372,7 +2372,7 @@ impl<'a> Parser<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Gen::Yes { span, .. } = genness {
|
if let Gen::Yes { span, .. } = genness {
|
||||||
self.sess.emit_err(errors::GenBlock { span });
|
self.sess.emit_err(errors::GenFn { span });
|
||||||
}
|
}
|
||||||
|
|
||||||
if !self.eat_keyword_case(kw::Fn, case) {
|
if !self.eat_keyword_case(kw::Fn, case) {
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
error: `gen` blocks are not yet implemented
|
error: `gen` functions are not yet implemented
|
||||||
--> $DIR/gen_fn.rs:4:1
|
--> $DIR/gen_fn.rs:4:1
|
||||||
|
|
|
|
||||||
LL | gen fn foo() {}
|
LL | gen fn foo() {}
|
||||||
| ^^^
|
| ^^^
|
||||||
|
|
|
|
||||||
= help: only the keyword is reserved for now
|
= help: for now you can use `gen {}` blocks and return `impl Iterator` instead
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,6 @@
|
||||||
|
|
||||||
gen fn foo() {}
|
gen fn foo() {}
|
||||||
//[none]~^ ERROR: expected one of `#`, `async`, `const`, `default`, `extern`, `fn`, `pub`, `unsafe`, or `use`, found `gen`
|
//[none]~^ ERROR: expected one of `#`, `async`, `const`, `default`, `extern`, `fn`, `pub`, `unsafe`, or `use`, found `gen`
|
||||||
//[e2024]~^^ ERROR: `gen` blocks are not yet implemented
|
//[e2024]~^^ ERROR: `gen` functions are not yet implemented
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue