about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2022-02-16 18:59:31 +0100
committerGitHub <noreply@github.com>2022-02-16 18:59:31 +0100
commita5a1ffb178e9a41eb8cd7417c8c18161be080de0 (patch)
tree0f5fbf1a711697e7cba0fe7a9a12990bf57ba343
parent75a631d4ba6bc1043a6eb0d4807dbceff316a354 (diff)
parent7fa87f2535a2b0b7ade1b85c470d5503b3bfdce3 (diff)
downloadrust-a5a1ffb178e9a41eb8cd7417c8c18161be080de0.tar.gz
rust-a5a1ffb178e9a41eb8cd7417c8c18161be080de0.zip
Rollup merge of #94017 - fee1-dead:unub, r=bjorn3
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 24b08be4074..7e5f8018dfc 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,