Make async gen fn an error
This commit is contained in:
@@ -562,6 +562,13 @@ pub(crate) struct GenFn {
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(parse_async_gen_fn)]
|
||||
pub(crate) struct AsyncGenFn {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(parse_comma_after_base_struct)]
|
||||
#[note]
|
||||
|
||||
@@ -2414,6 +2414,12 @@ impl<'a> Parser<'a> {
|
||||
self.sess.gated_spans.gate(sym::gen_blocks, span);
|
||||
}
|
||||
|
||||
if let (Async::Yes { span: async_span, .. }, Gen::Yes { span: gen_span, .. }) =
|
||||
(asyncness, genness)
|
||||
{
|
||||
self.sess.emit_err(errors::AsyncGenFn { span: async_span.to(gen_span) });
|
||||
}
|
||||
|
||||
if !self.eat_keyword_case(kw::Fn, case) {
|
||||
// It is possible for `expect_one_of` to recover given the contents of
|
||||
// `self.expected_tokens`, therefore, do not use `self.unexpected()` which doesn't
|
||||
|
||||
Reference in New Issue
Block a user