]> git.lizzy.rs Git - rust.git/blobdiff - tests/ui/suspicious_arithmetic_impl.rs
Merge pull request #2574 from mark-i-m/i128
[rust.git] / tests / ui / suspicious_arithmetic_impl.rs
index 22233a4b154290ec4bc0d3cdb25a5de09115488a..d5982efe12fbc8c7c722771d6c945940a0d85c9a 100644 (file)
@@ -59,7 +59,11 @@ impl Sub for Bar {
     type Output = Bar;
 
     fn sub(self, other: Self) -> Self {
-        Bar(-(self.0 & other.0)) // OK: UnNeg part of BiExpr as parent node
+        if self.0 <= other.0 {
+            Bar(-(self.0 & other.0)) // OK: UnNeg part of BiExpr as parent node
+        } else {
+            Bar(0)
+        }
     }
 }