about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2019-12-23 18:28:33 +0000
committerbors <bors@rust-lang.org>2019-12-23 18:28:33 +0000
commit9ae6cedb8d1e37469be1434642a3e403fce50a03 (patch)
tree94ea2d34cd99239633126bd50f0f0a5663e233b3 /src/libstd
parenta916ac22b9f7f1f0f7aba0a41a789b3ecd765018 (diff)
parent68a9a2d64888be73fda2d00ea1f5c121bc08164b (diff)
downloadrust-9ae6cedb8d1e37469be1434642a3e403fce50a03.tar.gz
rust-9ae6cedb8d1e37469be1434642a3e403fce50a03.zip
Auto merge of #67560 - Centril:rollup-fzdpu9c, r=Centril
Rollup of 8 pull requests

Successful merges:

 - #67233 (Add PartialEq and Eq to Cursor)
 - #67466 (Require const stability attributes on intrinsics to be able to use them in constant contexts)
 - #67507 (Remove mem::uninitalized from tests)
 - #67527 (Results show too much)
 - #67536 (Move `{hir::lowering -> hir}::is_range_literal`)
 - #67538 (Improve diagnostics for invalid assignment)
 - #67546 (Fix ICE in mir interpretation)
 - #67559 (Document that calling Drop, even after it panics, is UB)

Failed merges:

r? @ghost
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/io/cursor.rs14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/libstd/io/cursor.rs b/src/libstd/io/cursor.rs
index 1492f70436c..9787cbb556b 100644
--- a/src/libstd/io/cursor.rs
+++ b/src/libstd/io/cursor.rs
@@ -72,7 +72,7 @@ use core::convert::TryInto;
 /// }
 /// ```
 #[stable(feature = "rust1", since = "1.0.0")]
-#[derive(Clone, Debug, Default)]
+#[derive(Clone, Debug, Default, Eq, PartialEq)]
 pub struct Cursor<T> {
     inner: T,
     pos: u64,
@@ -942,4 +942,16 @@ mod tests {
         c.set_position(<usize>::max_value() as u64 + 1);
         assert!(c.write_all(&[1, 2, 3]).is_err());
     }
+
+    #[test]
+    fn test_partial_eq() {
+        assert_eq!(Cursor::new(Vec::<u8>::new()), Cursor::new(Vec::<u8>::new()));
+    }
+
+    #[test]
+    fn test_eq() {
+        struct AssertEq<T: Eq>(pub T);
+
+        let _: AssertEq<Cursor<Vec<u8>>> = AssertEq(Cursor::new(Vec::new()));
+    }
 }