-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Skip const-eval if evaluatable predicate is trivial #127242
Skip const-eval if evaluatable predicate is trivial #127242
Conversation
This comment has been minimized.
This comment has been minimized.
6f5ea7f
to
763bd0c
Compare
This comment has been minimized.
This comment has been minimized.
763bd0c
to
05c8ece
Compare
Some changes occurred in cc @BoxyUwU |
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 think there is not much point in landing this for a few reasons:
generic_const_exprs
is very unstable and this is likely to not be the final design so investing time (and code complexity) into small performance optimizations does not seem worth it to me- Logic for equating consts already has a similar special case to this that will check for
==
and short circuit and returnOk
if its true. - I would expect that this method of solving that ICE is masking an underlying issue, but I would have to poke at the example a bit more to figure out exactly what's going on
Regardless thanks for the interest in const generics :3
|
||
if tcx.features().generic_const_exprs { | ||
let ct = tcx.expand_abstract_consts(unexpanded_ct); | ||
|
||
if trivially_satisfied_from_param_env(ct, param_env) { |
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.
This would have had to go before the expand_abstract_consts
call as otherwise its never going to find any matches in the env since abstract consts arent expanded in the ParamEnv
:3
☔ The latest upstream changes (presumably #125915) made this pull request unmergeable. Please resolve the merge conflicts. |
Closing this so it's not in my list of assigned PRs anymore 😅 Feel free to reopen if you disagree with my comments and would like to continue this |
It appears that
ConstEvaluatable
predicate is given already inParamEnv
during type-checking in well-formness checks. This is an attempt at simplifying the checks.Fix #123959