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

Fix MIRI under tree borrows #266

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

djkoloski
Copy link

@djkoloski djkoloski commented May 19, 2024

This change consists of four modifications to fix the test suite when run under miri with MIRIFLAGS="-Zmiri-disable-stacked-borrows -Zmiri-tree-borrows":

  1. BitSlice now contains a trailing slice of [UnsafeCell<()>] rather than [()]. This corrects the pointer aliasing semantics for BitSlice so that the self reference does not assert shared or mutable aliasing.
  2. Locations which casted usizes back to pointers have been switched to use the unstable ptr::map_addr function when testing through miri. This function preserves the provenance of the pointer across bit manipulations. This fixes some warnings.
  3. A manual impl for RefUnwindSafe is now provided for BitSlice. I didn't think too hard about this but I'm pretty sure it's right.
  4. Some BitPtr tests have been fixed up to re-acquire pointers after mutating operations. This re-asserts mutable access to the underlying memory with the correct semantics for tree borrows.

@JoJoDeveloping
Copy link

note that -Zmiri-disable-stacked-borrows is unnecessary when combined with -Zmiri-tree-borrows.

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.

None yet

2 participants