]> git.lizzy.rs Git - rust.git/commitdiff
Clarify confusing UB statement in MIR
authorDeadbeef <ent3rm4n@gmail.com>
Tue, 15 Feb 2022 11:22:37 +0000 (22:22 +1100)
committerDeadbeef <ent3rm4n@gmail.com>
Tue, 15 Feb 2022 11:22:37 +0000 (22:22 +1100)
compiler/rustc_middle/src/mir/mod.rs

index 0688d7d2569f55248a5b1a39832baad327a8e88c..2d6afbe1130fa6aa8720c6475002c180dc40bb92 100644 (file)
@@ -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,