Skip to content
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

gate HandlerFunc behind target_arch = "x86{_64}" #507

Merged
merged 1 commit into from
Nov 15, 2024
Merged

Conversation

Freax13
Copy link
Member

@Freax13 Freax13 commented Oct 21, 2024

rustc is phasing out allowing the "x86-interrupt" ABI on non-x86 targets. Using "x86-interrupt" on a non-x86 target currently causes a warning, but this will become a hard error in a future version.

Previously, if abi_x86_interrupt was enabled (it's enabled by default), we used it in a pointer type for the declaration of the HandlerFunc- family of types and used a private empty tuple if abi_x86_interrupt wasn't enabled. This patch changes the cfg gate to only use the "x86-interrupt" abi on x86 targets. This is technically a breaking change, but I'd like to argue that we shouldn't treat it as such: The danger with treating this as a breaking change is that we can't release this fix as a patch update and so once rustc eventually treats this as an error, we might not yet have released the next breaking version leaving our users with not published fix.
My hope is that there is no one using HandlerFunc on a non-x86 target. Even today, declaring a function (not just a function pointer) with the "x86-interrupt" abi on a non-x86 target causes an error, so it's unlikely that this will affect real code. It's technically possible to create a HandlerFunc on a non-x86 target by using transmute, but, again my hope is that no one is actually doing that. I'd also like to point out that the only use of a HandlerFunc on a non-x86 target would be to call set_handler_fn and any such calls could simply be replaced by calls to set_handler_addr.

rustc is phasing out allowing the "x86-interrupt" ABI on non-x86
targets. Using "x86-interrupt" on a non-x86 target currently causes a
warning, but this will become a hard error in a future version.

Previously, if `abi_x86_interrupt` was enabled (it's enabled by default
), we used it in a pointer type for the declaration of the `HandlerFunc`-
family of types and used a private empty tuple if `abi_x86_interrupt`
wasn't enabled. This patch changes the cfg gate to only use the
"x86-interrupt" abi on x86 targets. This is technically a breaking
change, but I'd like to argue that we shouldn't treat it as such:
The danger with treating this as a breaking change is that we can't
release this fix as a patch update and so once rustc eventually treats
this as an error, we might not yet have released the next breaking
version leaving our users with not published fix.
My hope is that there is no one using `HandlerFunc` on a non-x86 target.
Even today, declaring a function (not just a function pointer) with the
"x86-interrupt" abi on a non-x86 target causes an error, so it's
unlikely that this will affect real code. It's technically possible to
create a `HandlerFunc` on a non-x86 target by using transmute, but,
again my hope is that no one is actually doing that. I'd also like to
point out that the only use of a `HandlerFunc` on a non-x86 target
would be to call set_handler_fn and any such calls could simply be
replaced by calls to set_handler_addr.
@Freax13
Copy link
Member Author

Freax13 commented Nov 14, 2024

Ping @phil-opp Could you please review this PR whenever you have the time? This PR fixes some issues on newer nightlies and in doing so also fixes CI (there have been a few PRs where I had to bypass CI to merge them because of the issues fixed in the PR).

Copy link
Member

@phil-opp phil-opp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I totally missed this PR, sorry about that!

Looks good to me, thank you!

@Freax13 Freax13 merged commit 7525088 into master Nov 15, 2024
13 checks passed
@Freax13 Freax13 deleted the fix/gate-handlers branch November 15, 2024 17:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants