x86_64 icon indicating copy to clipboard operation
x86_64 copied to clipboard

Type mismatch compilation error on rustc 1.90.0-nightly

Open wenxuanjun opened this issue 4 months ago • 1 comments

In this rustc version (0fa4ec6cd 2025-06-25), the compiler assumes that a function with signature extern "x86-interrupt" should not have a return type:

error: invalid signature for `extern "x86-interrupt"` function
   --> interrupts.rs:107:82
    |
107 | ...terruptStackFrame, error_code: u64) -> ! {
    |                                     ^
    |
    = note: functions with the "custom" ABI cannot have a return type
help: remove the return type
   --> interrupts.rs:107:82
    |
107 | ...terruptStackFrame, error_code: u64) -> ! {
    |

However, some handlers requires a DivergingHandlerFunc or DivergingHandlerFuncWithErrCode to be passed in, e.g.:

error[E0308]: mismatched types
   --> interrupts.rs:46:29
    |
46  |             .set_handler_fn(double_fault)
    |              -------------- ^^^^^^^^^^^^ expected fn pointer, found fn item
    |              |
    |              arguments to this method are incorrect
    |
    = note: expected fn pointer `extern "x86-interrupt" fn(x86_64::structures::idt::InterruptStackFrame, _) -> !`
                  found fn item `extern "x86-interrupt" fn(x86_64::structures::idt::InterruptStackFrame, _) -> () {arch::interrupts::double_fault}`

wenxuanjun avatar Jun 26 '25 20:06 wenxuanjun