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

SAFETY comments should document preconditions #20

Open
jdm opened this issue Jun 19, 2024 · 1 comment
Open

SAFETY comments should document preconditions #20

jdm opened this issue Jun 19, 2024 · 1 comment

Comments

@jdm
Copy link

jdm commented Jun 19, 2024

Reading through

//! The below implementation is a bit of a compromise in trying to help new devs
, I see unsafe blocks labeled with SAFETY comments, which is great! However, the comments focus on why the unsafe block is required (eg. a specific FFI call or unsafe API method), rather than what preconditions ensure the unsafe code is actually safe in practice.

@wmmc88
Copy link
Collaborator

wmmc88 commented Jun 19, 2024

Hi @jdm. Yes, I agree with your assessment of the safety comments currently present in the sample driver. We have much stricter enforcement for this on the windows-drivers-rs repo, and I wish to make improvements here in the samples.

That said, we are currently working on safer abstractions for the majority of the API surface covered in the current samples, so we will no longer need these unsafe blocks. Until then though, contributions are welcome 😊

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

No branches or pull requests

2 participants