-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Turn Cow::is_borrowed,is_owned
into associated functions.
#138217
base: master
Are you sure you want to change the base?
Turn Cow::is_borrowed,is_owned
into associated functions.
#138217
Conversation
This is done because `Cow` implements `Deref`. Therefore, to avoid conflicts with an inner type having a method of the same name, we use an associated method, like `Box::into_raw`.
r? @Noratrieb rustbot has assigned @Noratrieb. Use |
Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt |
r? libs-api |
So, +1 for documenting that users might want to call the functions this way if there's a conflict and they want to be explicit, but -1 for forcing the functions to be called this way. Yes, I understand that Cow implements Deref and these would shadow inner functions. However, we already have some methods on Cow: Did a crater run turn up some issue with these two new methods? I also think these two new methods aren't especially useful if they can't be written in postfix form; at that point, you're not far off from just using |
☔ The latest upstream changes (presumably #138208) made this pull request unmergeable. Please resolve the merge conflicts. |
This is done because
Cow
implementsDeref
. Therefore, to avoid conflicts with an inner type having a method of the same name, we use an associated method, likeBox::into_raw
.Tracking issue: #65143