1
Fork 0

Make some matches exhaustive to avoid bugs, fix tools

This commit is contained in:
Michael Goulet 2023-12-05 21:53:18 +00:00
parent a208bae00e
commit 44911b7c67
8 changed files with 71 additions and 45 deletions

View file

@ -1271,14 +1271,15 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
// Functions cannot both be `const async` or `const gen`
if let Some(&FnHeader {
constness: Const::Yes(cspan),
coroutine_kind:
Some(
CoroutineKind::Async { span: aspan, .. }
| CoroutineKind::Gen { span: aspan, .. },
),
coroutine_kind: Some(coro_kind),
..
}) = fk.header()
{
let aspan = match coro_kind {
CoroutineKind::Async { span: aspan, .. }
| CoroutineKind::Gen { span: aspan, .. }
| CoroutineKind::AsyncGen { span: aspan, .. } => aspan,
};
// FIXME(gen_blocks): Report a different error for `const gen`
self.err_handler().emit_err(errors::ConstAndAsync {
spans: vec![cspan, aspan],