From 7fa87f2535a2b0b7ade1b85c470d5503b3bfdce3 Mon Sep 17 00:00:00 2001 From: Deadbeef Date: Tue, 15 Feb 2022 22:22:37 +1100 Subject: [PATCH] Clarify confusing UB statement in MIR --- compiler/rustc_middle/src/mir/mod.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/compiler/rustc_middle/src/mir/mod.rs b/compiler/rustc_middle/src/mir/mod.rs index 0688d7d2569f5..2d6afbe1130fa 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,