-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Defer evaluating type system constants when they use infers or params #140553
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
base: master
Are you sure you want to change the base?
Conversation
This PR changes a file inside |
} else if tcx.def_kind(uv.def) == DefKind::AnonConst | ||
&& let ty::AnonConstKind::RepeatExprCount = tcx.anon_const_kind(uv.def) |
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.
we're calling def_kind
and anon_const_kind
twice here -- can we dedup?
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.
ur true :3 can just split this out into a Option<AnonConstKind>
local
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.
either that or merge both elses into a singular if tcx.def_kind() == anon_const { match tcx.anon_const_kind() { .. } }
?
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.
Turned it into one big match, not quite what you said but I think this is also good. lmk what u think
This comment has been minimized.
This comment has been minimized.
e276dd1
to
42f9d9a
Compare
This comment has been minimized.
This comment has been minimized.
42f9d9a
to
de3acb8
Compare
Split out of #137972, the parts necessary for associated const equality and min generic const args to make progress and have correct semantics around when CTFE is invoked. According to a previous perf run of adding the new
const_arg_kind
query we should expect minor regressions here.I think this is acceptable as we should be able to remove this query relatively soon once mgca is more complete as we'll then be able to implement GCE in terms of mgca and rip out
GCEConst
at which point it's trivial to determine what kind of anon const we're dealing with (either it has generics and is a repeat expr hack, or it doesnt and is a normal anon const).This should only affect unstable code as we handle repeat exprs specially and those are the only kinds of type system consts that are allowed to make use of generic parameters.
Fixes #133066
Fixes #133199
Fixes #136894
Fixes #137813
r? compiler-errors