Rollup merge of #109058 - tmiasko:is-checkable, r=jackh726

Document BinOp::is_checkable
This commit is contained in:
Matthias Krüger 2023-03-13 21:55:37 +01:00 committed by GitHub
commit 9fc8de0caa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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)