Enforce correct number of arguments for "x86-interrupt" functions
This commit is contained in:
@@ -405,6 +405,17 @@ impl<'a> AstValidator<'a> {
|
||||
if let InterruptKind::X86 = interrupt_kind {
|
||||
// "x86-interrupt" is special because it does have arguments.
|
||||
// FIXME(workingjubilee): properly lint on acceptable input types.
|
||||
let inputs = &sig.decl.inputs;
|
||||
let param_count = inputs.len();
|
||||
if !matches!(param_count, 1 | 2) {
|
||||
let mut spans: Vec<Span> =
|
||||
inputs.iter().map(|arg| arg.span).collect();
|
||||
if spans.is_empty() {
|
||||
spans = vec![sig.span];
|
||||
}
|
||||
self.dcx().emit_err(errors::AbiX86Interrupt { spans, param_count });
|
||||
}
|
||||
|
||||
if let FnRetTy::Ty(ref ret_ty) = sig.decl.output
|
||||
&& match &ret_ty.kind {
|
||||
TyKind::Never => false,
|
||||
|
||||
Reference in New Issue
Block a user