Skip to content
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

Rollup of 8 pull requests #98899

Closed
wants to merge 18 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
369555c
Implement `FusedIterator` for `std::net::[Into]Incoming`
ChayimFriedman2 May 23, 2022
b884797
Clarify MIR semantics of checked binary operations
tmiasko Jun 30, 2022
b8213bb
Enable raw-dylib for binaries
dpaoliello Jul 1, 2022
a368830
Improve spans for specialization error
compiler-errors Jul 1, 2022
76c0429
Bump std::net::Incoming FusedIterator impl to Rust 1.64
dtolnay Jul 2, 2022
7fc7780
fix interpreter validity check on Box
RalfJung Jul 3, 2022
d7edf66
move Box mess handling into general visitor
RalfJung Jul 4, 2022
658b7f3
more `rustc_pass_by_value`
lcnr Jul 4, 2022
eef5630
Fix wrap parenthesis suggestion for async closure
compiler-errors Jul 4, 2022
eb80407
suggest `#[derive(Default)]` to enums with `#[default]`
TaKO8Ki Jul 4, 2022
4e65d39
Rollup merge of #97300 - ChayimFriedman2:patch-1, r=dtolnay
Dylan-DPC Jul 4, 2022
9ed515f
Rollup merge of #98738 - tmiasko:checked-binop, r=oli-obk
Dylan-DPC Jul 4, 2022
829a718
Rollup merge of #98778 - dpaoliello:rawdylibbin, r=michaelwoerister
Dylan-DPC Jul 4, 2022
2ab4de7
Rollup merge of #98782 - compiler-errors:specialization-error-span, r…
Dylan-DPC Jul 4, 2022
7f27201
Rollup merge of #98847 - RalfJung:box-is-special, r=oli-obk
Dylan-DPC Jul 4, 2022
250f636
Rollup merge of #98873 - TaKO8Ki:suggest-default-derive-to-enum-with-…
Dylan-DPC Jul 4, 2022
bff8a2c
Rollup merge of #98878 - lcnr:more-rustc_pass_by_value, r=oli-obk
Dylan-DPC Jul 4, 2022
484fa44
Rollup merge of #98879 - compiler-errors:async-closure-wrap-parens, r…
Dylan-DPC Jul 4, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Clarify MIR semantics of checked binary operations
tmiasko committed Jun 30, 2022
commit b88479738ec8de29da27d9fd4bef5581c362e9b0
16 changes: 12 additions & 4 deletions compiler/rustc_middle/src/mir/syntax.rs
Original file line number Diff line number Diff line change
@@ -990,11 +990,19 @@ pub enum Rvalue<'tcx> {
/// matching types and return a value of that type.
BinaryOp(BinOp, Box<(Operand<'tcx>, Operand<'tcx>)>),

/// Same as `BinaryOp`, but yields `(T, bool)` instead of `T`. In addition to performing the
/// same computation as the matching `BinaryOp`, checks if the infinite precison result would be
/// unequal to the actual result and sets the `bool` if this is the case.
/// Same as `BinaryOp`, but yields `(T, bool)` with a `bool` indicating an error condition.
///
/// This only supports addition, subtraction, multiplication, and shift operations on integers.
/// When overflow checking is disabled, the error condition is false. Otherwise, the error
/// condition is determined as described below.
///
/// For addition, subtraction, and multiplication on integers the error condition is set when
/// the infinite precision result would be unequal to the actual result.
///
/// 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.
///
/// Other combinations of types and operators are unsupported.
CheckedBinaryOp(BinOp, Box<(Operand<'tcx>, Operand<'tcx>)>),

/// Computes a value as described by the operation.