-
Notifications
You must be signed in to change notification settings - Fork 14k
Replace Rvalue::NullaryOp by a variant in mir::ConstValue. #148766
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: main
Are you sure you want to change the base?
Conversation
|
Some changes occurred to the CTFE machinery Some changes occurred to the intrinsics. Make sure the CTFE / Miri interpreter cc @rust-lang/miri, @RalfJung, @oli-obk, @lcnr Some changes occurred in compiler/rustc_codegen_ssa Some changes occurred in compiler/rustc_codegen_cranelift cc @bjorn3 Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt
cc @rust-lang/wg-const-eval Some changes occurred in cc @BoxyUwU Some changes occurred in src/tools/clippy cc @rust-lang/clippy This PR changes MIR cc @oli-obk, @RalfJung, @JakobDegen, @vakaras Some changes occurred to the CTFE / Miri interpreter cc @rust-lang/miri This PR changes rustc_public cc @oli-obk, @celinval, @ouz-a Some changes occurred in match checking cc @Nadrieril Some changes occurred to constck cc @fee1-dead This PR changes a file inside |
This comment has been minimized.
This comment has been minimized.
9560745 to
741855c
Compare
This comment has been minimized.
This comment has been minimized.
741855c to
dcf0916
Compare
| /// Special constants whose value depends on the evaluation context. Their value depends on a | ||
| /// flag on the crate being codegenned. | ||
| RuntimeChecks(RuntimeChecks), |
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.
For const-eval execution, their value is fixed, right?
|
It seems slightly odd to call these things "constants" when they have a different value inside and outside of const blocks... I am not sure whether this actually breaks anything today, but it seems at least conceptually suboptimal and could lead to issues down the line. For instance, if a constant's body entirely consists just of one of these new constants, then replacing that outer constant by the inner one is not correct (or at least, it can change program behavior) -- so e.g. @saethlin's "trivial const" machinery might need a special case for this. |
|
☔ The latest upstream changes (presumably #148658) made this pull request unmergeable. Please resolve the merge conflicts. |
Based on #148151
This PR fully removes the MIR
Rvalue::NullaryOp. After #148151, it was only useful for runtime checks likeub_checks,contract_checksandoverflow_checks.These are "runtime" checks, boolean constants that may only be
truein codegen. It depends on a rustc flag passed to codegen, so we need to represent those flags cross-crate.This PR replaces those runtime checks by special variants in MIR
ConstValue. This allows code that expects constants to manipulate those as such, even if we may not always be able to evaluate them to actual scalars.