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

@ -541,12 +541,30 @@ fn check_test_signature(
return Err(sd.emit_err(errors::TestBadFn { span: i.span, cause: span, kind: "unsafe" }));
}
if let Some(ast::CoroutineKind::Async { span, .. }) = f.sig.header.coroutine_kind {
return Err(sd.emit_err(errors::TestBadFn { span: i.span, cause: span, kind: "async" }));
}
if let Some(ast::CoroutineKind::Gen { span, .. }) = f.sig.header.coroutine_kind {
return Err(sd.emit_err(errors::TestBadFn { span: i.span, cause: span, kind: "gen" }));
if let Some(coro_kind) = f.sig.header.coroutine_kind {
match coro_kind {
ast::CoroutineKind::Async { span, .. } => {
return Err(sd.emit_err(errors::TestBadFn {
span: i.span,
cause: span,
kind: "async",
}));
}
ast::CoroutineKind::Gen { span, .. } => {
return Err(sd.emit_err(errors::TestBadFn {
span: i.span,
cause: span,
kind: "gen",
}));
}
ast::CoroutineKind::AsyncGen { span, .. } => {
return Err(sd.emit_err(errors::TestBadFn {
span: i.span,
cause: span,
kind: "async gen",
}));
}
}
}
// If the termination trait is active, the compiler will check that the output