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

Allow raw pointers to be undef in Miri mode #56109

Closed
wants to merge 1 commit into from

Conversation

Aaron1011
Copy link
Member

The doctest at https://doc.rust-lang.org/std/mem/fn.uninitialized.html#examples
creates an uninitialized Vec - which (transitively) contains an
uninitialized raw pointer. Since this code is sound, Miri should allow
raw pointers to be undefined, to allow running this kind of code in
Miri.

I've left this as error in const_mode in order to avoid chaning the
behavior of const functions.

The doctest at https://doc.rust-lang.org/std/mem/fn.uninitialized.html#examples
creates an uninitialized Vec - which (transitively) contains an
uninitialized raw pointer. Since this code is sound, Miri should allow
raw pointers to be undefined, to allow running this kind of code in
Miri.

I've left this as error in const_mode in order to avoid chaning the
behavior of const functions.
@rust-highfive
Copy link
Collaborator

r? @nikomatsakis

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 20, 2018
@Aaron1011
Copy link
Member Author

r? @RalfJung

@Aaron1011
Copy link
Member Author

I'm not sure what the best way to write a test for this would be.

@Aaron1011
Copy link
Member Author

Oops - I just realized that this change was already made in #56094

@Aaron1011 Aaron1011 closed this Nov 20, 2018
@RalfJung
Copy link
Member

Since this code is sound

Rather -- since we haven't yet decided if this code is sound. ;) Whether undef is allowed in raw ptrs is not decided yet, and you shouldn't rely on it being allowed.

But yes, I already made the same change in that other PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants