Skip const-eval if evaluatable predicate is trivial#127242
Closed
dingxiangfei2009 wants to merge 1 commit intorust-lang:masterfrom
Closed
Skip const-eval if evaluatable predicate is trivial#127242dingxiangfei2009 wants to merge 1 commit intorust-lang:masterfrom
dingxiangfei2009 wants to merge 1 commit intorust-lang:masterfrom
Conversation
Collaborator
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
Collaborator
|
Some changes occurred in cc @BoxyUwU |
BoxyUwU
reviewed
Jul 13, 2024
Member
There was a problem hiding this comment.
I think there is not much point in landing this for a few reasons:
generic_const_exprsis 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 returnOkif 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) { |
Member
There was a problem hiding this comment.
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
Collaborator
|
☔ The latest upstream changes (presumably #125915) made this pull request unmergeable. Please resolve the merge conflicts. |
Member
|
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
It appears that
ConstEvaluatablepredicate is given already inParamEnvduring type-checking in well-formness checks. This is an attempt at simplifying the checks.Fix #123959