Skip to content

Commit

Permalink
Rollup merge of #109058 - tmiasko:is-checkable, r=jackh726
Browse files Browse the repository at this point in the history
Document BinOp::is_checkable
  • Loading branch information
matthiaskrgr authored Mar 13, 2023
2 parents f33292f + b16d6cc commit 9fc8de0
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions compiler/rustc_middle/src/mir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1999,6 +1999,9 @@ impl BorrowKind {
}

impl BinOp {
/// The checkable operators are those whose overflow checking behavior is controlled by
/// -Coverflow-checks option. The remaining operators have either no overflow conditions (e.g.,
/// BitAnd, BitOr, BitXor) or are always checked for overflow (e.g., Div, Rem).
pub fn is_checkable(self) -> bool {
use self::BinOp::*;
matches!(self, Add | Sub | Mul | Shl | Shr)
Expand Down

0 comments on commit 9fc8de0

Please sign in to comment.