Skip to content

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

Closed
wants to merge 5 commits into from

Conversation

brson
Copy link
Contributor

@brson brson commented Dec 29, 2013

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.

@sanxiyn
Copy link
Member

sanxiyn commented Dec 29, 2013

This also closes #7552.

@brson
Copy link
Contributor Author

brson commented Dec 31, 2013

@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.

@emberian
Copy link
Member

The manual mentioned it for enum variants

On Mon, Dec 30, 2013 at 7:08 PM, Brian Anderson [email protected]:

@cmr https://github.com/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.


Reply to this email directly or view it on GitHubhttps://github.com//pull/11188#issuecomment-31377089
.

@brson
Copy link
Contributor Author

brson commented Jan 2, 2014

r=alexcrichton p=1

I'm not sure if this was even intentional at this point.
bors added a commit that referenced this pull request Jan 4, 2014
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.
@bors bors closed this Jan 5, 2014
chris-morgan added a commit to chris-morgan/rust-http that referenced this pull request Jan 5, 2014
nham pushed a commit to nham/rust that referenced this pull request May 17, 2015
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.
bors added a commit that referenced this pull request May 17, 2015
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.
flip1995 pushed a commit to flip1995/rust that referenced this pull request Jul 31, 2023
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)`
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.

4 participants