-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
Fix: const_eval bugs #4761
Fix: const_eval bugs #4761
Conversation
…for enum instantionation
It would be great to have failing end-to-end tests with e.g. |
Done. |
Description
This PR is necessary for #4708
It fixes some problems with
const_eval
, most importantly:1 - It differentiates when an eval cannot be used inside const (there is a new error for that), and when expressions/statements just do not produce any value;
2 - It always cleans up
eval_codeblock
(it never shortcircuit with?
);Another advantage of the explicit error is the exact span of the "offending" expression, which we can use in the future for better error messages.
Checklist
Breaking*
orNew Feature
labels where relevant.