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

Use casts instead of transmute #43

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

Conversation

krdln
Copy link

@krdln krdln commented Mar 23, 2022

This commit also replaces .get_unchecked(0) with .as_ptr() (when casting slice to typed object), which makes MIRI slightly happier (in previous approach, the pointer was valid only for the first byte) – in fact, it now passes tests with following flags:

env MIRIFLAGS='-Zmiri-disable-alignment-check -Zmiri-disable-validation -Zmiri-tag-raw-pointers' \
    cargo miri test

This commit also replaces `.get_unchecked(0)` with `.as_ptr()` (when
casting slice to typed object), which makes MIRI slightly happier (in
previous approach, the pointer was valid only for the first byte) – in
fact, it now passes tests with following flags:

    env MIRIFLAGS='-Zmiri-disable-alignment-check -Zmiri-disable-validation -Zmiri-tag-raw-pointers' \
        cargo miri test
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.

1 participant