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

Implement AsMut for Vec #28663

Merged
merged 2 commits into from
Sep 27, 2015
Merged

Implement AsMut for Vec #28663

merged 2 commits into from
Sep 27, 2015

Conversation

bluss
Copy link
Member

@bluss bluss commented Sep 25, 2015

Implement AsMut for Vec

Fixes #28549

@rust-highfive
Copy link
Collaborator

r? @alexcrichton

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

@bluss
Copy link
Member Author

bluss commented Sep 25, 2015

I don't foresee any problems with this trait impl. Vec already implements AsRef, so it should impl AsMut.

Not handling Box since Box is missing both AsRef and AsMut. I thought we had a problem implementing them already, but I can't find any trace of it?

@alexcrichton
Copy link
Member

@bors: r+ 9b97264

@alexcrichton
Copy link
Member

We currently don't implement this for Box<T> because the meaning of as_ref on Box<Option<T>> would change (returning &Option<T> instead of Option<&T>). Which is to say it conflicts with Option::as_ref unfortunately.

Some discussion of this is happening on #27197 as well.

@bluss
Copy link
Member Author

bluss commented Sep 25, 2015

Updated with AsMut<Vec<T>>.

@alexcrichton
Copy link
Member

@bors: r+ 804efda

@bluss
Copy link
Member Author

bluss commented Sep 25, 2015

Thanks!

@bluss
Copy link
Member Author

bluss commented Sep 25, 2015

What about implementing AsRef<[T]> for Box<[T]> (and AsMut)? It's less general than implementing it for all Box<T>, but this should be without conflict.

@alexcrichton
Copy link
Member

Certainly a possibility to consider!

@bluss bluss added the relnotes Marks issues that should be documented in the release notes of the next release. label Sep 26, 2015
bors added a commit that referenced this pull request Sep 27, 2015
@bors
Copy link
Contributor

bors commented Sep 27, 2015

⌛ Testing commit 804efda with merge 219eca1...

@bors bors merged commit 804efda into rust-lang:master Sep 27, 2015
@bluss bluss deleted the vec-as-mut branch September 27, 2015 11:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
relnotes Marks issues that should be documented in the release notes of the next release.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants