-
Notifications
You must be signed in to change notification settings - Fork 13.5k
compiler: Allow extern "interrupt" fn() -> !
#143075
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
compiler: Allow extern "interrupt" fn() -> !
#143075
Conversation
This PR modifies cc @jieyouxu |
Now that the rules get more complex, I think the error on the return type should probably move to type Unit = ();
#[cfg(any(x64, i686))]
extern "x86-interrupt" fn x86_ret_unit() -> Unit {
unsafe { hint::unreachable_unchecked() }
} gives
The error message is also incorrect now: the function can have a return type (so long as it's |
765309e
to
b5ab966
Compare
I mean if I really want to get it right it should probably be even deeper, so we can check the actual layout. |
I don't think I want to do that level of correctness before we decide we actually want these interrupt ABIs, though, and I, at least, am not sold on them. |
This comment was marked as off-topic.
This comment was marked as off-topic.
Fair enough. Then the error message should at least be correct though right? (so, there can be a return type, just literally
The x86 one gets a surprising (to me) amount of use https://github.com/search?q=extern+%22x86-interrupt%22&type=code. But in theory those could now use naked functions and compile on stable. |
@andrewoffenden what. |
Yes, Phil Opp espoused using them, so they gained some popularity. But they should not be used by a real OS, because an OS cannot support any debugger APIs if it uses them. |
While reviewing #142633 I overlooked a few details because I was kind of excited.
Fixes #143072