File tree Expand file tree Collapse file tree 2 files changed +5
-1
lines changed Expand file tree Collapse file tree 2 files changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -319,7 +319,7 @@ pub struct String {
319
319
/// assert_eq!(vec![0, 159], value.unwrap_err().into_bytes());
320
320
/// ```
321
321
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
322
- #[ derive( Debug ) ]
322
+ #[ derive( Debug , Clone , PartialEq , Eq ) ]
323
323
pub struct FromUtf8Error {
324
324
bytes : Vec < u8 > ,
325
325
error : Utf8Error ,
Original file line number Diff line number Diff line change @@ -50,7 +50,11 @@ fn test_from_utf8() {
50
50
51
51
let xs = b"hello\xFF " . to_vec ( ) ;
52
52
let err = String :: from_utf8 ( xs) . unwrap_err ( ) ;
53
+ assert_eq ! ( err. as_bytes( ) , b"hello\xff " ) ;
54
+ let err_clone = err. clone ( ) ;
55
+ assert_eq ! ( err, err_clone) ;
53
56
assert_eq ! ( err. into_bytes( ) , b"hello\xff " . to_vec( ) ) ;
57
+ assert_eq ! ( err_clone. utf8_error( ) . valid_up_to( ) , 5 ) ;
54
58
}
55
59
56
60
#[ test]
You can’t perform that action at this time.
0 commit comments