Browse Source

wrapping: remove some WrappingNeg tests

Some WrappingNeg tests rely on core::ops::Neg being implemented for
core::num::Wrapping<_>. Since it was only added in Rust 1.10, this
causes the build to fail for version 1.8 (the MSRV).

The problematic tests have been replaced with a TODO. Ideally, if and
when the MSRV reaches 1.10, it will be a simple matter of reverting this
commit to bring back the tests.
Olivier Chassé St-Laurent 5 years ago
parent
commit
a883d87f31
1 changed files with 4 additions and 6 deletions
  1. 4 6
      src/ops/wrapping.rs

+ 4 - 6
src/ops/wrapping.rs

@@ -296,7 +296,8 @@ fn test_wrapping_traits() {
     assert_eq!(wrapping_add(255, 1), (Wrapping(255u8) + Wrapping(1u8)).0);
     assert_eq!(wrapping_sub(0, 1), (Wrapping(0u8) - Wrapping(1u8)).0);
     assert_eq!(wrapping_mul(255, 2), (Wrapping(255u8) * Wrapping(2u8)).0);
-    assert_eq!(wrapping_neg(255), (-Wrapping(255u8)).0);
+    // TODO: Test for Wrapping::Neg. Not possible yet since core::ops::Neg was
+    // only added to core::num::Wrapping<_> in Rust 1.10.
     assert_eq!(wrapping_shl(255, 8), (Wrapping(255u8) << 8).0);
     assert_eq!(wrapping_shr(255, 8), (Wrapping(255u8) >> 8).0);
 }
@@ -319,11 +320,8 @@ fn wrapping_is_wrappingmul() {
     require_wrappingmul(&Wrapping(42));
 }
 
-#[test]
-fn wrapping_is_wrappingneg() {
-    fn require_wrappingneg<T: WrappingNeg>(_: &T) {}
-    require_wrappingneg(&Wrapping(42))
-}
+// TODO: Test for Wrapping::Neg. Not possible yet since core::ops::Neg was
+// only added to core::num::Wrapping<_> in Rust 1.10.
 
 #[test]
 fn wrapping_is_wrappingshl() {