about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDeadbeef <ent3rm4n@gmail.com>2022-02-15 22:22:37 +1100
committerDeadbeef <ent3rm4n@gmail.com>2022-02-15 22:22:37 +1100
commit7fa87f2535a2b0b7ade1b85c470d5503b3bfdce3 (patch)
tree890e7d3879c52a80aca30a87b6a247e6462227f3
parent6655109f58b7d0f4cae7e04eab476e389c9b9a0f (diff)
downloadrust-7fa87f2535a2b0b7ade1b85c470d5503b3bfdce3.tar.gz
rust-7fa87f2535a2b0b7ade1b85c470d5503b3bfdce3.zip
Clarify confusing UB statement in MIR
-rw-r--r--compiler/rustc_middle/src/mir/mod.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/compiler/rustc_middle/src/mir/mod.rs b/compiler/rustc_middle/src/mir/mod.rs
index 0688d7d2569..2d6afbe1130 100644
--- a/compiler/rustc_middle/src/mir/mod.rs
+++ b/compiler/rustc_middle/src/mir/mod.rs
@@ -2270,11 +2270,13 @@ pub enum BinOp {
     Mul,
     /// The `/` operator (division)
     ///
-    /// Division by zero is UB.
+    /// Division by zero is UB, because the compiler should have inserted checks
+    /// prior to this.
     Div,
     /// The `%` operator (modulus)
     ///
-    /// Using zero as the modulus (second operand) is UB.
+    /// Using zero as the modulus (second operand) is UB, because the compiler
+    /// should have inserted checks prior to this.
     Rem,
     /// The `^` operator (bitwise xor)
     BitXor,