-
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
Split {ast,hir,...}::Static(Mutability) into Static and StaticMut. #60110
Conversation
r? @cramertj (rust_highfive has picked a reviewer for you, use r? to override) |
This seems like a step backwards wrt. #54912 and extending it to arbitrary patterns, e.g. |
r? @oli-obk |
This is impractical, IMO. See the next comment regarding data in |
How I see
The most commonly used cached data is the " Mutability in |
I definitely prefer #60124. In fact my first reaction to this PR was "why isn't it using the |
FWIW, I'm already doing the refactor in question, and |
Static
is currently the only variant ofDef
that describes anItem
and contains more than theDefId
of that item (i.e. it contains the mutability).This lack of uniformity is making some refactors/cleanups a bit harder, or more annoying.
There are primarily two alternatives, AFAICT:
StaticMut
its own kind of item/def (this PR)is_const_fn
)DefId
and not{ast,hir}::ItemKind::Static
I was hoping 1. would be simpler than it turned out to be, but I did the work anyway, so I'm presenting this PR for people to judge which approach they prefer.
(e.g. all the changes to
Static | StaticMut
, in patterns, would be unnecessary for 2.)cc @petrochenkov @oli-obk @nikomatsakis @michaelwoerister