From b16d6ccdcd4653f2b1e347901c4fab6c8927e645 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Mi=C4=85sko?= Date: Sun, 12 Mar 2023 00:00:00 +0000 Subject: [PATCH] Document BinOp::is_checkable --- compiler/rustc_middle/src/mir/mod.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/compiler/rustc_middle/src/mir/mod.rs b/compiler/rustc_middle/src/mir/mod.rs index 5215e3db798a2..b34651c3ea797 100644 --- a/compiler/rustc_middle/src/mir/mod.rs +++ b/compiler/rustc_middle/src/mir/mod.rs @@ -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)