File tree 1 file changed +10
-1
lines changed
1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,8 @@ extern crate syntax;
17
17
use std:: str:: FromStr ;
18
18
use std:: env;
19
19
20
+ use hex:: FromHexError ;
21
+
20
22
use rustc_interface:: interface;
21
23
use rustc:: hir:: def_id:: LOCAL_CRATE ;
22
24
@@ -153,7 +155,14 @@ fn main() {
153
155
if seed. is_some ( ) {
154
156
panic ! ( "Cannot specify -Zmiri-seed multiple times!" ) ;
155
157
}
156
- let seed_raw = hex:: decode ( arg. trim_start_matches ( "-Zmiri-seed=" ) ) . unwrap ( ) ;
158
+ let seed_raw = hex:: decode ( arg. trim_start_matches ( "-Zmiri-seed=" ) )
159
+ . unwrap_or_else ( |err| match err {
160
+ FromHexError :: InvalidHexCharacter { .. } => panic ! (
161
+ "-Zmiri-seed should only contain valid hex digits [0-9a-fA-F]"
162
+ ) ,
163
+ FromHexError :: OddLength => panic ! ( "-Zmiri-seed should have an even number of digits" ) ,
164
+ err => panic ! ( "Unknown error decoding -Zmiri-seed as hex: {:?}" , err) ,
165
+ } ) ;
157
166
if seed_raw. len ( ) > 8 {
158
167
panic ! ( format!( "-Zmiri-seed must be at most 8 bytes, was {}" , seed_raw. len( ) ) ) ;
159
168
}
You can’t perform that action at this time.
0 commit comments