Skip to content

Audit/document/remove unsafe code #27

@jneem

Description

@jneem

We have unsafe code in a few places, and the invariants that need to be upheld are not always well-documented.

  • in Vector::swap we use unsafe because rust doesn't know that pointers to different indices are non-overlapping. I think this is fine, although it could be removed at the cost of a clone() and an extra swap.
  • in the hash table, there is unsafe code in insert, because we need to move out of something before we're ready to move a new value in. This could be removed at the cost of an additional "uninitialized" enum variant in Entry. I'm not sure what the cost of that is.
  • there's some unsafe code related to the "pool" feature. This code is currently disabled in imbl (it's only relevant when using Rc instead of Arc, and we don't have that yet). This part is therefore a lower priority.
  • there is a bunch of unsafe code dealing with Focus and FocusMut. This will take some time to figure out. There's some subtlety in FocusMut::split_at and FocusMut::unmut.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions