-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Remove the magic deref behavior of newtype structs and enums #11188
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
Conversation
This also closes #7552. |
@cmr I can't find any references to this behavior in the manual. It's true I didn't add any tests for errors since testing for the absence of a feature didn't seem that useful to me. I'll add a new error message that indicates this is a removed feature. |
The manual mentioned it for enum variants On Mon, Dec 30, 2013 at 7:08 PM, Brian Anderson [email protected]:
|
r=alexcrichton p=1 |
I'm not sure if this was even intentional at this point.
This code was wrong but apparently worked before removing struct deref. I don't know why.
This removes the feature where newtype structs can be dereferenced like pointers, and likewise where certain enums can be dereferenced (which I imagine nobody realized still existed). This ad-hoc behavior is to be replaced by a more general overloadable dereference trait in the future. I've been nursing this patch for two months and think it's about rebased up to master. @nikomatsakis this makes a bunch of your type checking code noticeably uglier.
A built-in feature enabling the dereferencing of newtype structs was removed in PR rust-lang#11188, and this error (E0068) was added at the same time to warn of its removal. It seems to make sense to remove the error now, given that the obsolete feature it is warning about was removed nearly a year and a half ago.
A built-in feature enabling the dereferencing of newtype structs was removed in PR #11188, and this error (E0068) was added at the same time to warn of its removal. It seems to make sense to remove the error now, given that the obsolete feature it is warning about was removed nearly a year and a half ago.
Allow `Self::cmp(self, other)` as a correct impl Fixes rust-lang#11178 Also no longer checks if the method name is *just* cmp, but the path. That was an oversight on my part ^^ r? `@xFrednet` (and `@blyxyas` too!) changelog: [`incorrect_partial_ord_impl_on_ord_type`]: Now allows non-method calls to `cmp` like `Self::cmp(self, other)`
This removes the feature where newtype structs can be dereferenced like pointers, and likewise where certain enums can be dereferenced (which I imagine nobody realized still existed). This ad-hoc behavior is to be replaced by a more general overloadable dereference trait in the future.
I've been nursing this patch for two months and think it's about rebased up to master.
@nikomatsakis this makes a bunch of your type checking code noticeably uglier.