about summary refs log tree commit diff
diff options
context:
space:
mode:
authorTomasz Miąsko <tomasz.miasko@gmail.com>2023-03-12 00:00:00 +0000
committerTomasz Miąsko <tomasz.miasko@gmail.com>2023-03-12 00:00:00 +0000
commitb16d6ccdcd4653f2b1e347901c4fab6c8927e645 (patch)
tree784d4e943a2ef6e1c181339a9ccfe23fa1996fe5
parent938afba8996fe058b91c61b23ef5d000cb9ac169 (diff)
downloadrust-b16d6ccdcd4653f2b1e347901c4fab6c8927e645.tar.gz
rust-b16d6ccdcd4653f2b1e347901c4fab6c8927e645.zip
Document BinOp::is_checkable
-rw-r--r--compiler/rustc_middle/src/mir/mod.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/compiler/rustc_middle/src/mir/mod.rs b/compiler/rustc_middle/src/mir/mod.rs
index 5215e3db798..b34651c3ea7 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)