File tree 1 file changed +9
-4
lines changed
compiler/rustc_middle/src/mir
1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -1272,13 +1272,18 @@ pub enum BinOp {
1272
1272
Mul ,
1273
1273
/// The `/` operator (division)
1274
1274
///
1275
- /// Division by zero is UB, because the compiler should have inserted checks
1276
- /// prior to this.
1275
+ /// For integer types, division by zero is UB, as is `MIN / -1` for signed.
1276
+ /// The compiler should have inserted checks prior to this.
1277
+ ///
1278
+ /// Floating-point division by zero is safe, and does not need guards.
1277
1279
Div ,
1278
1280
/// The `%` operator (modulus)
1279
1281
///
1280
- /// Using zero as the modulus (second operand) is UB, because the compiler
1281
- /// should have inserted checks prior to this.
1282
+ /// For integer types, using zero as the modulus (second operand) is UB,
1283
+ /// as is `MIN % -1` for signed.
1284
+ /// The compiler should have inserted checks prior to this.
1285
+ ///
1286
+ /// Floating-point remainder by zero is safe, and does not need guards.
1282
1287
Rem ,
1283
1288
/// The `^` operator (bitwise xor)
1284
1289
BitXor ,
You can’t perform that action at this time.
0 commit comments