about summary refs log tree commit diff
path: root/src/liballoc/tests/string.rs
diff options
context:
space:
mode:
authorJonas Schievink <jonasschievink@gmail.com>2020-02-09 18:23:28 +0100
committerGitHub <noreply@github.com>2020-02-09 18:23:28 +0100
commit0b50319af69d52ce9806e91fba777986dec4e417 (patch)
treef104fd5e6a23902c377df9fbaaaf15999b3249eb /src/liballoc/tests/string.rs
parent6dff769e3718c56f78a317df7167426d60895d58 (diff)
parent847d5b4d1387a30f1798a5c3c59c3e0c31e00319 (diff)
downloadrust-0b50319af69d52ce9806e91fba777986dec4e417.tar.gz
rust-0b50319af69d52ce9806e91fba777986dec4e417.zip
Rollup merge of #68738 - kennytm:derive-clone-eq-for-fromutf8error, r=sfackler
Derive Clone + Eq for std::string::FromUtf8Error

Implement `Clone` and `Eq` for `std::string::FromUtf8Error`.

Both the inner `Vec<u8>` and `std::str::Utf8Error` are also `Clone + Eq`, so I don't see why we shouldn't derive them on `FromUtf8Error` as well.

(impl are insta-stable, requiring FCP from T-libs.)
Diffstat (limited to 'src/liballoc/tests/string.rs')
-rw-r--r--src/liballoc/tests/string.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/liballoc/tests/string.rs b/src/liballoc/tests/string.rs
index dd444958459..08859b2b24b 100644
--- a/src/liballoc/tests/string.rs
+++ b/src/liballoc/tests/string.rs
@@ -50,7 +50,11 @@ fn test_from_utf8() {
 
     let xs = b"hello\xFF".to_vec();
     let err = String::from_utf8(xs).unwrap_err();
+    assert_eq!(err.as_bytes(), b"hello\xff");
+    let err_clone = err.clone();
+    assert_eq!(err, err_clone);
     assert_eq!(err.into_bytes(), b"hello\xff".to_vec());
+    assert_eq!(err_clone.utf8_error().valid_up_to(), 5);
 }
 
 #[test]