Enforce correct number of arguments for "x86-interrupt" functions

This commit is contained in:
Pavel Grigorenko
2025-08-20 14:34:48 +03:00
parent bec747418c
commit 2da0ec3453
23 changed files with 197 additions and 123 deletions

View File

@@ -20,6 +20,10 @@ ast_passes_abi_must_not_have_return_type=
.note = functions with the {$abi} ABI cannot have a return type
.help = remove the return type
ast_passes_abi_x86_interrupt =
invalid signature for `extern "x86-interrupt"` function
.note = functions with the "x86-interrupt" ABI must be have either 1 or 2 parameters (but found {$param_count})
ast_passes_assoc_const_without_body =
associated constant in `impl` without body
.suggestion = provide a definition for the constant

View File

@@ -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,

View File

@@ -891,3 +891,12 @@ pub(crate) struct AbiMustNotHaveReturnType {
pub span: Span,
pub abi: ExternAbi,
}
#[derive(Diagnostic)]
#[diag(ast_passes_abi_x86_interrupt)]
#[note]
pub(crate) struct AbiX86Interrupt {
#[primary_span]
pub spans: Vec<Span>,
pub param_count: usize,
}

View File

@@ -15,4 +15,4 @@ use minicore::*;
// CHECK: define x86_intrcc void @has_x86_interrupt_abi
#[no_mangle]
pub extern "x86-interrupt" fn has_x86_interrupt_abi() {}
pub extern "x86-interrupt" fn has_x86_interrupt_abi(_p: *const u8) {}

View File

@@ -18,10 +18,10 @@ pub fn caller() {
unsafe { asm!("call {}", sym page_fault_handler) }
}
// CHECK: declare x86_intrcc void @page_fault_handler(){{.*}}#[[ATTRS:[0-9]+]]
// CHECK: declare x86_intrcc void @page_fault_handler(ptr {{.*}}, i64{{.*}}){{.*}}#[[ATTRS:[0-9]+]]
#[unsafe(naked)]
#[no_mangle]
pub extern "x86-interrupt" fn page_fault_handler() {
pub extern "x86-interrupt" fn page_fault_handler(_: u64, _: u64) {
naked_asm!("ud2")
}

View File

@@ -19,53 +19,53 @@ LL | extern "riscv-interrupt-s" fn riscv_s() {}
error[E0570]: "x86-interrupt" is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:45:8
|
LL | extern "x86-interrupt" fn x86() {}
LL | extern "x86-interrupt" fn x86(_x: *const u8) {}
| ^^^^^^^^^^^^^^^
error[E0570]: "msp430-interrupt" is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:70:25
--> $DIR/cannot-be-called.rs:72:25
|
LL | fn msp430_ptr(f: extern "msp430-interrupt" fn()) {
| ^^^^^^^^^^^^^^^^^^
error[E0570]: "riscv-interrupt-m" is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:76:26
--> $DIR/cannot-be-called.rs:78:26
|
LL | fn riscv_m_ptr(f: extern "riscv-interrupt-m" fn()) {
| ^^^^^^^^^^^^^^^^^^^
error[E0570]: "riscv-interrupt-s" is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:82:26
--> $DIR/cannot-be-called.rs:84:26
|
LL | fn riscv_s_ptr(f: extern "riscv-interrupt-s" fn()) {
| ^^^^^^^^^^^^^^^^^^^
error[E0570]: "x86-interrupt" is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:88:22
--> $DIR/cannot-be-called.rs:90:22
|
LL | fn x86_ptr(f: extern "x86-interrupt" fn()) {
| ^^^^^^^^^^^^^^^
error: functions with the "avr-interrupt" ABI cannot be called
--> $DIR/cannot-be-called.rs:50:5
--> $DIR/cannot-be-called.rs:52:5
|
LL | avr();
| ^^^^^
|
note: an `extern "avr-interrupt"` function can only be called using inline assembly
--> $DIR/cannot-be-called.rs:50:5
--> $DIR/cannot-be-called.rs:52:5
|
LL | avr();
| ^^^^^
error: functions with the "avr-interrupt" ABI cannot be called
--> $DIR/cannot-be-called.rs:66:5
--> $DIR/cannot-be-called.rs:68:5
|
LL | f()
| ^^^
|
note: an `extern "avr-interrupt"` function can only be called using inline assembly
--> $DIR/cannot-be-called.rs:66:5
--> $DIR/cannot-be-called.rs:68:5
|
LL | f()
| ^^^

View File

@@ -23,49 +23,49 @@ LL | extern "riscv-interrupt-s" fn riscv_s() {}
| ^^^^^^^^^^^^^^^^^^^
error[E0570]: "avr-interrupt" is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:64:22
--> $DIR/cannot-be-called.rs:66:22
|
LL | fn avr_ptr(f: extern "avr-interrupt" fn()) {
| ^^^^^^^^^^^^^^^
error[E0570]: "msp430-interrupt" is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:70:25
--> $DIR/cannot-be-called.rs:72:25
|
LL | fn msp430_ptr(f: extern "msp430-interrupt" fn()) {
| ^^^^^^^^^^^^^^^^^^
error[E0570]: "riscv-interrupt-m" is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:76:26
--> $DIR/cannot-be-called.rs:78:26
|
LL | fn riscv_m_ptr(f: extern "riscv-interrupt-m" fn()) {
| ^^^^^^^^^^^^^^^^^^^
error[E0570]: "riscv-interrupt-s" is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:82:26
--> $DIR/cannot-be-called.rs:84:26
|
LL | fn riscv_s_ptr(f: extern "riscv-interrupt-s" fn()) {
| ^^^^^^^^^^^^^^^^^^^
error: functions with the "x86-interrupt" ABI cannot be called
--> $DIR/cannot-be-called.rs:58:5
--> $DIR/cannot-be-called.rs:60:5
|
LL | x86();
| ^^^^^
LL | x86(&raw const BYTE);
| ^^^^^^^^^^^^^^^^^^^^
|
note: an `extern "x86-interrupt"` function can only be called using inline assembly
--> $DIR/cannot-be-called.rs:58:5
--> $DIR/cannot-be-called.rs:60:5
|
LL | x86();
| ^^^^^
LL | x86(&raw const BYTE);
| ^^^^^^^^^^^^^^^^^^^^
error: functions with the "x86-interrupt" ABI cannot be called
--> $DIR/cannot-be-called.rs:90:5
--> $DIR/cannot-be-called.rs:92:5
|
LL | f()
| ^^^
|
note: an `extern "x86-interrupt"` function can only be called using inline assembly
--> $DIR/cannot-be-called.rs:90:5
--> $DIR/cannot-be-called.rs:92:5
|
LL | f()
| ^^^

View File

@@ -19,53 +19,53 @@ LL | extern "riscv-interrupt-s" fn riscv_s() {}
error[E0570]: "x86-interrupt" is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:45:8
|
LL | extern "x86-interrupt" fn x86() {}
LL | extern "x86-interrupt" fn x86(_x: *const u8) {}
| ^^^^^^^^^^^^^^^
error[E0570]: "avr-interrupt" is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:64:22
--> $DIR/cannot-be-called.rs:66:22
|
LL | fn avr_ptr(f: extern "avr-interrupt" fn()) {
| ^^^^^^^^^^^^^^^
error[E0570]: "riscv-interrupt-m" is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:76:26
--> $DIR/cannot-be-called.rs:78:26
|
LL | fn riscv_m_ptr(f: extern "riscv-interrupt-m" fn()) {
| ^^^^^^^^^^^^^^^^^^^
error[E0570]: "riscv-interrupt-s" is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:82:26
--> $DIR/cannot-be-called.rs:84:26
|
LL | fn riscv_s_ptr(f: extern "riscv-interrupt-s" fn()) {
| ^^^^^^^^^^^^^^^^^^^
error[E0570]: "x86-interrupt" is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:88:22
--> $DIR/cannot-be-called.rs:90:22
|
LL | fn x86_ptr(f: extern "x86-interrupt" fn()) {
| ^^^^^^^^^^^^^^^
error: functions with the "msp430-interrupt" ABI cannot be called
--> $DIR/cannot-be-called.rs:52:5
--> $DIR/cannot-be-called.rs:54:5
|
LL | msp430();
| ^^^^^^^^
|
note: an `extern "msp430-interrupt"` function can only be called using inline assembly
--> $DIR/cannot-be-called.rs:52:5
--> $DIR/cannot-be-called.rs:54:5
|
LL | msp430();
| ^^^^^^^^
error: functions with the "msp430-interrupt" ABI cannot be called
--> $DIR/cannot-be-called.rs:72:5
--> $DIR/cannot-be-called.rs:74:5
|
LL | f()
| ^^^
|
note: an `extern "msp430-interrupt"` function can only be called using inline assembly
--> $DIR/cannot-be-called.rs:72:5
--> $DIR/cannot-be-called.rs:74:5
|
LL | f()
| ^^^

View File

@@ -13,71 +13,71 @@ LL | extern "avr-interrupt" fn avr() {}
error[E0570]: "x86-interrupt" is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:45:8
|
LL | extern "x86-interrupt" fn x86() {}
LL | extern "x86-interrupt" fn x86(_x: *const u8) {}
| ^^^^^^^^^^^^^^^
error[E0570]: "avr-interrupt" is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:64:22
--> $DIR/cannot-be-called.rs:66:22
|
LL | fn avr_ptr(f: extern "avr-interrupt" fn()) {
| ^^^^^^^^^^^^^^^
error[E0570]: "msp430-interrupt" is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:70:25
--> $DIR/cannot-be-called.rs:72:25
|
LL | fn msp430_ptr(f: extern "msp430-interrupt" fn()) {
| ^^^^^^^^^^^^^^^^^^
error[E0570]: "x86-interrupt" is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:88:22
--> $DIR/cannot-be-called.rs:90:22
|
LL | fn x86_ptr(f: extern "x86-interrupt" fn()) {
| ^^^^^^^^^^^^^^^
error: functions with the "riscv-interrupt-m" ABI cannot be called
--> $DIR/cannot-be-called.rs:54:5
--> $DIR/cannot-be-called.rs:56:5
|
LL | riscv_m();
| ^^^^^^^^^
|
note: an `extern "riscv-interrupt-m"` function can only be called using inline assembly
--> $DIR/cannot-be-called.rs:54:5
--> $DIR/cannot-be-called.rs:56:5
|
LL | riscv_m();
| ^^^^^^^^^
error: functions with the "riscv-interrupt-s" ABI cannot be called
--> $DIR/cannot-be-called.rs:56:5
--> $DIR/cannot-be-called.rs:58:5
|
LL | riscv_s();
| ^^^^^^^^^
|
note: an `extern "riscv-interrupt-s"` function can only be called using inline assembly
--> $DIR/cannot-be-called.rs:56:5
--> $DIR/cannot-be-called.rs:58:5
|
LL | riscv_s();
| ^^^^^^^^^
error: functions with the "riscv-interrupt-m" ABI cannot be called
--> $DIR/cannot-be-called.rs:78:5
--> $DIR/cannot-be-called.rs:80:5
|
LL | f()
| ^^^
|
note: an `extern "riscv-interrupt-m"` function can only be called using inline assembly
--> $DIR/cannot-be-called.rs:78:5
--> $DIR/cannot-be-called.rs:80:5
|
LL | f()
| ^^^
error: functions with the "riscv-interrupt-s" ABI cannot be called
--> $DIR/cannot-be-called.rs:84:5
--> $DIR/cannot-be-called.rs:86:5
|
LL | f()
| ^^^
|
note: an `extern "riscv-interrupt-s"` function can only be called using inline assembly
--> $DIR/cannot-be-called.rs:84:5
--> $DIR/cannot-be-called.rs:86:5
|
LL | f()
| ^^^

View File

@@ -13,71 +13,71 @@ LL | extern "avr-interrupt" fn avr() {}
error[E0570]: "x86-interrupt" is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:45:8
|
LL | extern "x86-interrupt" fn x86() {}
LL | extern "x86-interrupt" fn x86(_x: *const u8) {}
| ^^^^^^^^^^^^^^^
error[E0570]: "avr-interrupt" is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:64:22
--> $DIR/cannot-be-called.rs:66:22
|
LL | fn avr_ptr(f: extern "avr-interrupt" fn()) {
| ^^^^^^^^^^^^^^^
error[E0570]: "msp430-interrupt" is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:70:25
--> $DIR/cannot-be-called.rs:72:25
|
LL | fn msp430_ptr(f: extern "msp430-interrupt" fn()) {
| ^^^^^^^^^^^^^^^^^^
error[E0570]: "x86-interrupt" is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:88:22
--> $DIR/cannot-be-called.rs:90:22
|
LL | fn x86_ptr(f: extern "x86-interrupt" fn()) {
| ^^^^^^^^^^^^^^^
error: functions with the "riscv-interrupt-m" ABI cannot be called
--> $DIR/cannot-be-called.rs:54:5
--> $DIR/cannot-be-called.rs:56:5
|
LL | riscv_m();
| ^^^^^^^^^
|
note: an `extern "riscv-interrupt-m"` function can only be called using inline assembly
--> $DIR/cannot-be-called.rs:54:5
--> $DIR/cannot-be-called.rs:56:5
|
LL | riscv_m();
| ^^^^^^^^^
error: functions with the "riscv-interrupt-s" ABI cannot be called
--> $DIR/cannot-be-called.rs:56:5
--> $DIR/cannot-be-called.rs:58:5
|
LL | riscv_s();
| ^^^^^^^^^
|
note: an `extern "riscv-interrupt-s"` function can only be called using inline assembly
--> $DIR/cannot-be-called.rs:56:5
--> $DIR/cannot-be-called.rs:58:5
|
LL | riscv_s();
| ^^^^^^^^^
error: functions with the "riscv-interrupt-m" ABI cannot be called
--> $DIR/cannot-be-called.rs:78:5
--> $DIR/cannot-be-called.rs:80:5
|
LL | f()
| ^^^
|
note: an `extern "riscv-interrupt-m"` function can only be called using inline assembly
--> $DIR/cannot-be-called.rs:78:5
--> $DIR/cannot-be-called.rs:80:5
|
LL | f()
| ^^^
error: functions with the "riscv-interrupt-s" ABI cannot be called
--> $DIR/cannot-be-called.rs:84:5
--> $DIR/cannot-be-called.rs:86:5
|
LL | f()
| ^^^
|
note: an `extern "riscv-interrupt-s"` function can only be called using inline assembly
--> $DIR/cannot-be-called.rs:84:5
--> $DIR/cannot-be-called.rs:86:5
|
LL | f()
| ^^^

View File

@@ -42,9 +42,11 @@ extern "riscv-interrupt-m" fn riscv_m() {}
//[x64,x64_win,i686,avr,msp430]~^ ERROR is not a supported ABI
extern "riscv-interrupt-s" fn riscv_s() {}
//[x64,x64_win,i686,avr,msp430]~^ ERROR is not a supported ABI
extern "x86-interrupt" fn x86() {}
extern "x86-interrupt" fn x86(_x: *const u8) {}
//[riscv32,riscv64,avr,msp430]~^ ERROR is not a supported ABI
static BYTE: u8 = 0;
/* extern "interrupt" calls */
fn call_the_interrupts() {
avr();
@@ -55,7 +57,7 @@ fn call_the_interrupts() {
//[riscv32,riscv64]~^ ERROR functions with the "riscv-interrupt-m" ABI cannot be called
riscv_s();
//[riscv32,riscv64]~^ ERROR functions with the "riscv-interrupt-s" ABI cannot be called
x86();
x86(&raw const BYTE);
//[x64,x64_win,i686]~^ ERROR functions with the "x86-interrupt" ABI cannot be called
}

View File

@@ -23,49 +23,49 @@ LL | extern "riscv-interrupt-s" fn riscv_s() {}
| ^^^^^^^^^^^^^^^^^^^
error[E0570]: "avr-interrupt" is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:64:22
--> $DIR/cannot-be-called.rs:66:22
|
LL | fn avr_ptr(f: extern "avr-interrupt" fn()) {
| ^^^^^^^^^^^^^^^
error[E0570]: "msp430-interrupt" is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:70:25
--> $DIR/cannot-be-called.rs:72:25
|
LL | fn msp430_ptr(f: extern "msp430-interrupt" fn()) {
| ^^^^^^^^^^^^^^^^^^
error[E0570]: "riscv-interrupt-m" is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:76:26
--> $DIR/cannot-be-called.rs:78:26
|
LL | fn riscv_m_ptr(f: extern "riscv-interrupt-m" fn()) {
| ^^^^^^^^^^^^^^^^^^^
error[E0570]: "riscv-interrupt-s" is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:82:26
--> $DIR/cannot-be-called.rs:84:26
|
LL | fn riscv_s_ptr(f: extern "riscv-interrupt-s" fn()) {
| ^^^^^^^^^^^^^^^^^^^
error: functions with the "x86-interrupt" ABI cannot be called
--> $DIR/cannot-be-called.rs:58:5
--> $DIR/cannot-be-called.rs:60:5
|
LL | x86();
| ^^^^^
LL | x86(&raw const BYTE);
| ^^^^^^^^^^^^^^^^^^^^
|
note: an `extern "x86-interrupt"` function can only be called using inline assembly
--> $DIR/cannot-be-called.rs:58:5
--> $DIR/cannot-be-called.rs:60:5
|
LL | x86();
| ^^^^^
LL | x86(&raw const BYTE);
| ^^^^^^^^^^^^^^^^^^^^
error: functions with the "x86-interrupt" ABI cannot be called
--> $DIR/cannot-be-called.rs:90:5
--> $DIR/cannot-be-called.rs:92:5
|
LL | f()
| ^^^
|
note: an `extern "x86-interrupt"` function can only be called using inline assembly
--> $DIR/cannot-be-called.rs:90:5
--> $DIR/cannot-be-called.rs:92:5
|
LL | f()
| ^^^

View File

@@ -23,49 +23,49 @@ LL | extern "riscv-interrupt-s" fn riscv_s() {}
| ^^^^^^^^^^^^^^^^^^^
error[E0570]: "avr-interrupt" is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:64:22
--> $DIR/cannot-be-called.rs:66:22
|
LL | fn avr_ptr(f: extern "avr-interrupt" fn()) {
| ^^^^^^^^^^^^^^^
error[E0570]: "msp430-interrupt" is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:70:25
--> $DIR/cannot-be-called.rs:72:25
|
LL | fn msp430_ptr(f: extern "msp430-interrupt" fn()) {
| ^^^^^^^^^^^^^^^^^^
error[E0570]: "riscv-interrupt-m" is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:76:26
--> $DIR/cannot-be-called.rs:78:26
|
LL | fn riscv_m_ptr(f: extern "riscv-interrupt-m" fn()) {
| ^^^^^^^^^^^^^^^^^^^
error[E0570]: "riscv-interrupt-s" is not a supported ABI for the current target
--> $DIR/cannot-be-called.rs:82:26
--> $DIR/cannot-be-called.rs:84:26
|
LL | fn riscv_s_ptr(f: extern "riscv-interrupt-s" fn()) {
| ^^^^^^^^^^^^^^^^^^^
error: functions with the "x86-interrupt" ABI cannot be called
--> $DIR/cannot-be-called.rs:58:5
--> $DIR/cannot-be-called.rs:60:5
|
LL | x86();
| ^^^^^
LL | x86(&raw const BYTE);
| ^^^^^^^^^^^^^^^^^^^^
|
note: an `extern "x86-interrupt"` function can only be called using inline assembly
--> $DIR/cannot-be-called.rs:58:5
--> $DIR/cannot-be-called.rs:60:5
|
LL | x86();
| ^^^^^
LL | x86(&raw const BYTE);
| ^^^^^^^^^^^^^^^^^^^^
error: functions with the "x86-interrupt" ABI cannot be called
--> $DIR/cannot-be-called.rs:90:5
--> $DIR/cannot-be-called.rs:92:5
|
LL | f()
| ^^^
|
note: an `extern "x86-interrupt"` function can only be called using inline assembly
--> $DIR/cannot-be-called.rs:90:5
--> $DIR/cannot-be-called.rs:92:5
|
LL | f()
| ^^^

View File

@@ -1,13 +1,13 @@
error: functions with the "x86-interrupt" ABI cannot be `async`
--> $DIR/cannot-be-coroutine.rs:52:1
|
LL | async extern "x86-interrupt" fn x86() {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | async extern "x86-interrupt" fn x86(_p: *mut ()) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: remove the `async` keyword from this definition
|
LL - async extern "x86-interrupt" fn x86() {
LL + extern "x86-interrupt" fn x86() {
LL - async extern "x86-interrupt" fn x86(_p: *mut ()) {
LL + extern "x86-interrupt" fn x86(_p: *mut ()) {
|
error: requires `ResumeTy` lang_item

View File

@@ -49,6 +49,6 @@ async extern "riscv-interrupt-s" fn riscv_s() {
//[riscv32,riscv64]~^ ERROR functions with the "riscv-interrupt-s" ABI cannot be `async`
}
async extern "x86-interrupt" fn x86() {
async extern "x86-interrupt" fn x86(_p: *mut ()) {
//[x64,x64_win,i686]~^ ERROR functions with the "x86-interrupt" ABI cannot be `async`
}

View File

@@ -1,13 +1,13 @@
error: functions with the "x86-interrupt" ABI cannot be `async`
--> $DIR/cannot-be-coroutine.rs:52:1
|
LL | async extern "x86-interrupt" fn x86() {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | async extern "x86-interrupt" fn x86(_p: *mut ()) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: remove the `async` keyword from this definition
|
LL - async extern "x86-interrupt" fn x86() {
LL + extern "x86-interrupt" fn x86() {
LL - async extern "x86-interrupt" fn x86(_p: *mut ()) {
LL + extern "x86-interrupt" fn x86(_p: *mut ()) {
|
error: requires `ResumeTy` lang_item

View File

@@ -1,13 +1,13 @@
error: functions with the "x86-interrupt" ABI cannot be `async`
--> $DIR/cannot-be-coroutine.rs:52:1
|
LL | async extern "x86-interrupt" fn x86() {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | async extern "x86-interrupt" fn x86(_p: *mut ()) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: remove the `async` keyword from this definition
|
LL - async extern "x86-interrupt" fn x86() {
LL + extern "x86-interrupt" fn x86() {
LL - async extern "x86-interrupt" fn x86(_p: *mut ()) {
LL + extern "x86-interrupt" fn x86(_p: *mut ()) {
|
error: requires `ResumeTy` lang_item

View File

@@ -1,15 +1,31 @@
error: invalid signature for `extern "x86-interrupt"` function
--> $DIR/interrupt-invalid-signature.rs:83:40
--> $DIR/interrupt-invalid-signature.rs:83:53
|
LL | extern "x86-interrupt" fn x86_ret() -> u8 {
| ^^
LL | extern "x86-interrupt" fn x86_ret(_p: *const u8) -> u8 {
| ^^
|
= note: functions with the "x86-interrupt" ABI cannot have a return type
help: remove the return type
--> $DIR/interrupt-invalid-signature.rs:83:40
--> $DIR/interrupt-invalid-signature.rs:83:53
|
LL | extern "x86-interrupt" fn x86_ret() -> u8 {
| ^^
LL | extern "x86-interrupt" fn x86_ret(_p: *const u8) -> u8 {
| ^^
error: aborting due to 1 previous error
error: invalid signature for `extern "x86-interrupt"` function
--> $DIR/interrupt-invalid-signature.rs:89:1
|
LL | extern "x86-interrupt" fn x86_0() {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: functions with the "x86-interrupt" ABI must be have either 1 or 2 parameters (but found 0)
error: invalid signature for `extern "x86-interrupt"` function
--> $DIR/interrupt-invalid-signature.rs:100:33
|
LL | extern "x86-interrupt" fn x86_3(_p1: *const u8, _p2: *const u8, _p3: *const u8) {
| ^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^
|
= note: functions with the "x86-interrupt" ABI must be have either 1 or 2 parameters (but found 3)
error: aborting due to 3 previous errors

View File

@@ -80,11 +80,27 @@ extern "riscv-interrupt-s" fn riscv_s_ret() -> u8 {
}
#[cfg(any(x64,i686))]
extern "x86-interrupt" fn x86_ret() -> u8 {
extern "x86-interrupt" fn x86_ret(_p: *const u8) -> u8 {
//[x64,i686]~^ ERROR invalid signature
1
}
#[cfg(any(x64,i686))]
extern "x86-interrupt" fn x86_0() {
//[x64,i686]~^ ERROR invalid signature
}
#[cfg(any(x64,i686))]
extern "x86-interrupt" fn x86_1(_p1: *const u8) { }
#[cfg(any(x64,i686))]
extern "x86-interrupt" fn x86_2(_p1: *const u8, _p2: *const u8) { }
#[cfg(any(x64,i686))]
extern "x86-interrupt" fn x86_3(_p1: *const u8, _p2: *const u8, _p3: *const u8) {
//[x64,i686]~^ ERROR invalid signature
}
/* extern "interrupt" fnptrs with invalid signatures */

View File

@@ -1,15 +1,31 @@
error: invalid signature for `extern "x86-interrupt"` function
--> $DIR/interrupt-invalid-signature.rs:83:40
--> $DIR/interrupt-invalid-signature.rs:83:53
|
LL | extern "x86-interrupt" fn x86_ret() -> u8 {
| ^^
LL | extern "x86-interrupt" fn x86_ret(_p: *const u8) -> u8 {
| ^^
|
= note: functions with the "x86-interrupt" ABI cannot have a return type
help: remove the return type
--> $DIR/interrupt-invalid-signature.rs:83:40
--> $DIR/interrupt-invalid-signature.rs:83:53
|
LL | extern "x86-interrupt" fn x86_ret() -> u8 {
| ^^
LL | extern "x86-interrupt" fn x86_ret(_p: *const u8) -> u8 {
| ^^
error: aborting due to 1 previous error
error: invalid signature for `extern "x86-interrupt"` function
--> $DIR/interrupt-invalid-signature.rs:89:1
|
LL | extern "x86-interrupt" fn x86_0() {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: functions with the "x86-interrupt" ABI must be have either 1 or 2 parameters (but found 0)
error: invalid signature for `extern "x86-interrupt"` function
--> $DIR/interrupt-invalid-signature.rs:100:33
|
LL | extern "x86-interrupt" fn x86_3(_p1: *const u8, _p2: *const u8, _p3: *const u8) {
| ^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^
|
= note: functions with the "x86-interrupt" ABI must be have either 1 or 2 parameters (but found 3)
error: aborting due to 3 previous errors

View File

@@ -56,7 +56,7 @@ extern "riscv-interrupt-s" fn riscv_s_ret_never() -> ! {
}
#[cfg(any(x64,i686))]
extern "x86-interrupt" fn x86_ret_never() -> ! {
extern "x86-interrupt" fn x86_ret_never(_p: *const u8) -> ! {
loop {}
}
@@ -83,7 +83,7 @@ extern "riscv-interrupt-s" fn riscv_s_ret_unit() -> () {
}
#[cfg(any(x64,i686))]
extern "x86-interrupt" fn x86_ret_unit() -> () {
extern "x86-interrupt" fn x86_ret_unit(_x: *const u8) -> () {
()
}

View File

@@ -7,22 +7,22 @@
extern crate minicore;
use minicore::*;
extern "x86-interrupt" fn f7() {} //~ ERROR "x86-interrupt" ABI is experimental
extern "x86-interrupt" fn f7(_p: *const u8) {} //~ ERROR "x86-interrupt" ABI is experimental
trait Tr {
extern "x86-interrupt" fn m7(); //~ ERROR "x86-interrupt" ABI is experimental
extern "x86-interrupt" fn dm7() {} //~ ERROR "x86-interrupt" ABI is experimental
extern "x86-interrupt" fn m7(_p: *const u8); //~ ERROR "x86-interrupt" ABI is experimental
extern "x86-interrupt" fn dm7(_p: *const u8) {} //~ ERROR "x86-interrupt" ABI is experimental
}
struct S;
// Methods in trait impl
impl Tr for S {
extern "x86-interrupt" fn m7() {} //~ ERROR "x86-interrupt" ABI is experimental
extern "x86-interrupt" fn m7(_p: *const u8) {} //~ ERROR "x86-interrupt" ABI is experimental
}
// Methods in inherent impl
impl S {
extern "x86-interrupt" fn im7() {} //~ ERROR "x86-interrupt" ABI is experimental
extern "x86-interrupt" fn im7(_p: *const u8) {} //~ ERROR "x86-interrupt" ABI is experimental
}
type A7 = extern "x86-interrupt" fn(); //~ ERROR "x86-interrupt" ABI is experimental

View File

@@ -1,7 +1,7 @@
error[E0658]: the extern "x86-interrupt" ABI is experimental and subject to change
--> $DIR/feature-gate-abi-x86-interrupt.rs:10:8
|
LL | extern "x86-interrupt" fn f7() {}
LL | extern "x86-interrupt" fn f7(_p: *const u8) {}
| ^^^^^^^^^^^^^^^
|
= note: see issue #40180 <https://github.com/rust-lang/rust/issues/40180> for more information
@@ -11,7 +11,7 @@ LL | extern "x86-interrupt" fn f7() {}
error[E0658]: the extern "x86-interrupt" ABI is experimental and subject to change
--> $DIR/feature-gate-abi-x86-interrupt.rs:12:12
|
LL | extern "x86-interrupt" fn m7();
LL | extern "x86-interrupt" fn m7(_p: *const u8);
| ^^^^^^^^^^^^^^^
|
= note: see issue #40180 <https://github.com/rust-lang/rust/issues/40180> for more information
@@ -21,7 +21,7 @@ LL | extern "x86-interrupt" fn m7();
error[E0658]: the extern "x86-interrupt" ABI is experimental and subject to change
--> $DIR/feature-gate-abi-x86-interrupt.rs:13:12
|
LL | extern "x86-interrupt" fn dm7() {}
LL | extern "x86-interrupt" fn dm7(_p: *const u8) {}
| ^^^^^^^^^^^^^^^
|
= note: see issue #40180 <https://github.com/rust-lang/rust/issues/40180> for more information
@@ -31,7 +31,7 @@ LL | extern "x86-interrupt" fn dm7() {}
error[E0658]: the extern "x86-interrupt" ABI is experimental and subject to change
--> $DIR/feature-gate-abi-x86-interrupt.rs:20:12
|
LL | extern "x86-interrupt" fn m7() {}
LL | extern "x86-interrupt" fn m7(_p: *const u8) {}
| ^^^^^^^^^^^^^^^
|
= note: see issue #40180 <https://github.com/rust-lang/rust/issues/40180> for more information
@@ -41,7 +41,7 @@ LL | extern "x86-interrupt" fn m7() {}
error[E0658]: the extern "x86-interrupt" ABI is experimental and subject to change
--> $DIR/feature-gate-abi-x86-interrupt.rs:25:12
|
LL | extern "x86-interrupt" fn im7() {}
LL | extern "x86-interrupt" fn im7(_p: *const u8) {}
| ^^^^^^^^^^^^^^^
|
= note: see issue #40180 <https://github.com/rust-lang/rust/issues/40180> for more information