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

&mut as restrict #561

Open
TheBlueMatt opened this issue Aug 9, 2020 · 1 comment
Open

&mut as restrict #561

TheBlueMatt opened this issue Aug 9, 2020 · 1 comment

Comments

@TheBlueMatt
Copy link

Forgive my ignorance, but should it not be the case that &mut references (and *mut pointers?) are mapped in C as restrict-pointers, not regular ol' pointers? Rust assumes &mut references are noalias, and at least used to generate LLVM IR to indicate that (though at various points that has introduced bugs). It seems, then, that the correct mapping for Rust mut things is restrict. Of course this somewhat begs the question of what the equivalent of a non-restrict-pointer is in Rust, but my understanding is no such thing exists.

@emilio
Copy link
Collaborator

emilio commented Aug 10, 2020

Yeah, we could do that potentially, though AIUI rustc still doesn't make mutable references noalias... I don't think it'd be controversial to put this behind a flag if wanted.

A non-restrict pointer in rust is just a *mut T pointer :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants