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

Partial safety comments #101

Merged
merged 11 commits into from
Mar 13, 2024
Merged

Partial safety comments #101

merged 11 commits into from
Mar 13, 2024

Conversation

Manishearth
Copy link
Contributor

Progress on #98

Figured I'd land what I have so far.

I still need to do:

  • mem.rs (partial)
  • lib.rs
  • utf_8.rs

Furthermore, I've not done too much commenting in handles.rs: I think there are some refactors to that code that may reduce the number of tricky invariants.

There's also a safety todo around endianness in ascii.rs.

The general methodology I'm using is:

  • document every unsafe block
  • if the unsafe block relies on invariants that are not immediately checked above it, document that invariant on the relevant variable (and if it is mutated, on every mutation point)
  • make sure all functions have safety invariants documented

@Manishearth
Copy link
Contributor Author

r? @hsivonen

src/single_byte.rs Show resolved Hide resolved
src/x_user_defined.rs Show resolved Hide resolved
Copy link
Owner

@hsivonen hsivonen left a comment

Choose a reason for hiding this comment

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

Thank you!

@hsivonen hsivonen merged commit 966fc0a into hsivonen:master Mar 13, 2024
@Manishearth Manishearth deleted the unsafe branch May 21, 2024 23:51
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.

3 participants