Skip to content

Clean up the checks for Self type parameters #50125

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

Closed
cuviper opened this issue Apr 20, 2018 · 0 comments · Fixed by #63463
Closed

Clean up the checks for Self type parameters #50125

cuviper opened this issue Apr 20, 2018 · 0 comments · Fixed by #63463
Labels
A-type-system Area: Type system C-cleanup Category: PRs that clean code up or issues documenting cleanup. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@cuviper
Copy link
Member

cuviper commented Apr 20, 2018

per @eddyb in #49889 (comment)

I don't think we should need is_self and has_self_ty (or the gensym hack altogether), and instead we should rely on knowing that e.g. the item in scope is a trait and thus index 0 is Self.

@cuviper cuviper added C-cleanup Category: PRs that clean code up or issues documenting cleanup. A-type-system Area: Type system T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Apr 20, 2018
alexcrichton added a commit to alexcrichton/rust that referenced this issue Apr 20, 2018
This commit papers over rust-lang#49889 (introducing a fixme pointing at rust-lang#50125) for a
bug that was introduced with rust-lang#49695. This workaround is taken from rust-lang#49891.
bors added a commit that referenced this issue Aug 24, 2018
rustc: remove Ty::{is_self, has_self_ty}.

Fixes #50125 by replacing special-casing of `Self` (and the gensym hack) with getting the type for the `Self` parameter from the trait, and comparing types with that, instead.

**NOTE**: this is part of #53661, split out to independently check performance impact.
bors added a commit that referenced this issue Aug 13, 2019
Don't special case the `Self` parameter by name

This results in a couple of small diagnostic regressions. They could be avoided by keeping the special case just for diagnostics, but that seems worse.

closes #50125
cc #60869
@bors bors closed this as completed in a807902 Aug 19, 2019
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-type-system Area: Type system C-cleanup Category: PRs that clean code up or issues documenting cleanup. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant