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 {
319319/// assert_eq!(vec![0, 159], value.unwrap_err().into_bytes());
320320/// ```
321321#[ stable( feature = "rust1" , since = "1.0.0" ) ]
322- #[ derive( Debug ) ]
322+ #[ derive( Debug , Clone , PartialEq , Eq ) ]
323323pub struct FromUtf8Error {
324324 bytes : Vec < u8 > ,
325325 error : Utf8Error ,
Original file line number Diff line number Diff line change @@ -50,7 +50,11 @@ fn test_from_utf8() {
5050
5151 let xs = b"hello\xFF " . to_vec ( ) ;
5252 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) ;
5356 assert_eq ! ( err. into_bytes( ) , b"hello\xff " . to_vec( ) ) ;
57+ assert_eq ! ( err_clone. utf8_error( ) . valid_up_to( ) , 5 ) ;
5458}
5559
5660#[ test]
You can’t perform that action at this time.
0 commit comments