-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Symbol cleanups #110175
Symbol cleanups #110175
Conversation
For a common pattern.
There's a bad pattern matching confusion present in this function. `_anon` gets assigned to, and then `_anon` is used as an unbound variable in the pattern, which is unrelated to the first `_anon`. If the `_anon` didn't start with `_` the compiler would give warnings. This was introduced in rust-lang#104239. I have rewritten the function to remove the confusion and preserve the existing behaviour. This seems safest, because the original intent is not clear.
Best reviewed one commit at a time. |
@bors r+ |
match self { | ||
RegionCtxt::Unknown => 1, | ||
RegionCtxt::Existential(None) => 2, | ||
RegionCtxt::Existential(Some(_anon)) | RegionCtxt::Free(_anon) => 2, | ||
RegionCtxt::Existential(Some(_)) | RegionCtxt::Free(_) => 2, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for catching the mistake here, but using _
here is not correct I believe. This should match for the anon
symbol inside RegionCtxt::Existential
or RegionCtxt::Free
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just tried doing what you suggested and then I ran all the tests and they passed. So it doesn't seem to make much difference. In what case might this matter?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this code is only used for sccs_info
, which is used to give information on region vars (for debugging purposes only currently). I think we should prefer to use actual region names (if available, otherwise they are anon
) over region information through Location
or TyContext
(though whether these are really more informative is debatable anyway I guess).
…kh726 Symbol cleanups r? `@jackh726` cc `@b-naber`
I did something similar in the past, but it seems there have been new cases of |
…kh726 Symbol cleanups r? `@jackh726` cc `@b-naber`
…kh726 Symbol cleanups r? ``@jackh726`` cc ``@b-naber``
…iaskrgr Rollup of 8 pull requests Successful merges: - rust-lang#110153 (Fix typos in compiler) - rust-lang#110165 (rustdoc: use CSS `overscroll-behavior` instead of JavaScript) - rust-lang#110175 (Symbol cleanups) - rust-lang#110203 (Remove `..` from return type notation) - rust-lang#110205 (rustdoc: make settings radio and checks thicker, less contrast) - rust-lang#110222 (Improve the error message when forwarding a matched fragment to another macro) - rust-lang#110237 (Split out a separate feature gate for impl trait in associated types) - rust-lang#110241 (tidy: Issue an error when UI test limits are too high) Failed merges: - rust-lang#110218 (Remove `ToRegionVid`) r? `@ghost` `@rustbot` modify labels: rollup
r? @jackh726
cc @b-naber