-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Clarify MIR semantics of checked binary operations #98738
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
This PR changes MIR |
r? @cjgillot (rust-highfive has picked a reviewer for you, use r? to override) |
I'll defer review to MIR semantics specialists. |
@bors r+ rollup |
📌 Commit b884797 has been approved by |
Clarify MIR semantics of checked binary operations
Clarify MIR semantics of checked binary operations
/// | ||
/// For shift operations on integers the error condition is set when the value of right-hand | ||
/// side is greater than or equal to the number of bits in the type of the left-hand side, or | ||
/// when the value of right-hand side is negative. |
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.
Note that the "negative" thing is rather subtle currently: codegen doesn't actually check whether the type is signed or not. If we had u256
, then the current codegen logic would break. See here for details.
Clarify MIR semantics of checked binary operations
…askrgr Rollup of 8 pull requests Successful merges: - rust-lang#98738 (Clarify MIR semantics of checked binary operations) - rust-lang#98782 (Improve spans for specialization error) - rust-lang#98793 (Lint against executable files in the root directory) - rust-lang#98814 (rustdoc: Censor certain complex unevaluated const exprs) - rust-lang#98878 (add more `rustc_pass_by_value`) - rust-lang#98879 (Fix "wrap closure in parenthesis" suggestion for `async` closure) - rust-lang#98886 (incr.comp.: Make split-dwarf commandline options [TRACKED].) - rust-lang#98898 (Add "no-div-regex" eslint rule) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
…li-obk interpret: fix CheckedBinOp behavior when overflow checking is disabled Adjusts the interpreter to rust-lang#98738. r? `@oli-obk`
…li-obk interpret: fix CheckedBinOp behavior when overflow checking is disabled Adjusts the interpreter to rust-lang#98738. r? ``@oli-obk``
No description provided.