Skip to content

uefi-macros: Drop !Send and !Sync from unsafe_protocol macro #758

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

Merged
merged 1 commit into from
Apr 11, 2023

Conversation

nicholasbishop
Copy link
Member

Protocols can only be used while boot services are active, and that's already a single-threaded environment 1, so these negative traits do not have any effect. (Note that many protocols will still be automatically !Send/!Sync due to containing raw pointers.)

In addition, there's nothing particularly special about protocols; we have lots of structs that are intended for use during boot services and can't be safely shared between threads. There are no threads to worry about in the UEFI environment though, so none of them need to be explictly marked !Send/!Sync.

Checklist

  • Sensible git history (for example, squash "typo" or "fix" commits). See the Rewriting History guide for help.
  • Update the changelog (if necessary)

Protocols can only be used while boot services are active, and that's already a
single-threaded environment [1], so these negative traits do not have any
effect. (Note that many protocols will still be automatically `!Send`/`!Sync`
due to containing raw pointers.)

In addition, there's nothing particularly special about protocols; we have lots
of structs that are intended for use during boot services and can't be safely
shared between threads. There are no threads to worry about in the UEFI
environment though, so none of them need to be explictly marked `!Send`/`!Sync`.

[1]: https://github.com/rust-lang/rust/blob/4f87a63edcef5c8c06229ff13e0f64f427537378/compiler/rustc_target/src/spec/uefi_msvc_base.rs#L47
@phip1611 phip1611 merged commit 3e5240d into rust-osdev:main Apr 11, 2023
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