-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Ignore zero-sized types in wasm future-compat warning #139498
base: master
Are you sure you want to change the base?
Conversation
This commit fixes a false positive of the warning triggered for rust-lang#138762 and the fix is to codify that zero-sized types are "safe" in both the old and new ABIs.
r? @wesleywiser rustbot has assigned @wesleywiser. Use |
I've additionally tagged this for a beta backport since the false positive is currently in beta too. |
@@ -111,6 +111,11 @@ fn wasm_abi_safe<'tcx>(tcx: TyCtxt<'tcx>, arg: &ArgAbi<'tcx, Ty<'tcx>>) -> bool | |||
} | |||
} | |||
|
|||
// Zero-sized types are dropped in both ABIs, so they're safe | |||
if arg.layout.size.bytes() == 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question: can this use arg.layout.is_zst()
or arg.layout.is_1zst()
(does alignment matter here?)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I'm pretty unfamiliar with this code so I fear I probably am not the best to answer this. AFAIK any zero-sized-type will be omitted in the old/new ABI so I don't believe alignment matters, so I don't know which of these methods for testing for a zst is best.
This commit fixes a false positive of the warning triggered for #138762 and the fix is to codify that zero-sized types are "safe" in both the old and new ABIs.