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

Add more array references to raw pointer casts 2. #33411

Closed
wants to merge 2 commits into from

Conversation

jagourq
Copy link
Contributor

@jagourq jagourq commented May 4, 2016

Adds &mut [T; n] to *mut T and &mut [T; n] to *const T casts. Closes #24151 and resubmits the changes made in #31418.

@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @Aatch (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@Aatch
Copy link
Contributor

Aatch commented May 5, 2016

The original issue doesn't mention &mut [T; n] -> *const T casts.

@nrc, @alexcrichton is that ok? Note that &mut T -> *const T works as a cast (the &mut T is coearced to a &T first).

@nrc
Copy link
Member

nrc commented May 5, 2016

In general, casting is not transitive - A -> B -> C does not imply A -> C. In this case, I think the &mut [T; n] -> *const T is OK. I see no reason to disallow it, at leasy.

@alexcrichton
Copy link
Member

I'm not sure whether this was intended to be allowed, but I think there was an RFC on it?

@jagourq
Copy link
Contributor Author

jagourq commented Jun 3, 2016

One thing I did notice when writing tests for the change was the file vector-cast-weirdness.rs checked to see that casts from &mut [T; n] to *mut T failed. It also checked for something that is now allowed which seemed strange.

@alexcrichton alexcrichton assigned nrc and unassigned Aatch Jul 19, 2016
@alexcrichton
Copy link
Member

Closing due to inactivity, but feel free to resubmit!

@jagourq
Copy link
Contributor Author

jagourq commented Nov 23, 2016

@alexcrichton are there any changes I should make before resubmitting?

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.

6 participants