-
Notifications
You must be signed in to change notification settings - Fork 20
ACP: change as_{mut,const}
on pointers to cast_{mut,const}
#51
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
can you link to the example you're referring to? |
I'm not sure what broke, but to be more explicit about the confusion, we have one that casts and one that forms a reference, which is an unresolved question on rust-lang/rust#92675.
|
that seems to support the renaming being proposed here |
👍 from me. Having the common prefix sounds good. |
Seconded @rustbot label +initial-comment-period |
Error: Malformed Please let |
gosh dangit |
trying to fix it but, uuuh, github is having a moment... #52 just gonna add the label manually for now |
There was also an interesting point that Regarding breaking the docs, I meant this: rust-lang/rust#96327 |
According to https://rust-lang.github.io/api-guidelines/naming.html#ad-hoc-conversions-follow-as_-to_-into_-conventions-c-conv that wouldn't be consistent with the ways we normally use |
There is already |
Since this is a method of a It would put the method in the same category as e.g. |
We discussed this in today's libs-api meeting, and ended up settling on |
…cast, r=scottmcm Rename `<*{mut,const} T>::as_{const,mut}` to `cast_` This renames the methods to use the `cast_` prefix instead of `as_` to make it more readable and avoid confusion with `<*mut T>::as_mut()` which is `unsafe` and returns a reference. Sorry, didn't notice ACP process exists, opened rust-lang/libs-team#51 See rust-lang#92675
…cast, r=scottmcm Rename `<*{mut,const} T>::as_{const,mut}` to `cast_` This renames the methods to use the `cast_` prefix instead of `as_` to make it more readable and avoid confusion with `<*mut T>::as_mut()` which is `unsafe` and returns a reference. Sorry, didn't notice ACP process exists, opened rust-lang/libs-team#51 See rust-lang#92675
…cottmcm Rename `<*{mut,const} T>::as_{const,mut}` to `cast_` This renames the methods to use the `cast_` prefix instead of `as_` to make it more readable and avoid confusion with `<*mut T>::as_mut()` which is `unsafe` and returns a reference. Sorry, didn't notice ACP process exists, opened rust-lang/libs-team#51 See #92675
Proposal
Problem statement
The
as_mut
method on*const T
may be confused with*mut T
.Motivation, use-cases
This confusion already broke the doc once. Also I believe
cast_
is more clear, especially since a similarcast()
method exists.Solution sketches
Rename the method to use
cast_
prefixLinks and related work
#92675
#98174
What happens now?
This issue is part of the libs-api team API change proposal process. Once this issue is filed the libs-api team will review open proposals in its weekly meeting. You should receive feedback within a week or two.
The text was updated successfully, but these errors were encountered: