File tree 1 file changed +9
-5
lines changed
src/tools/build-manifest/src
1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change 4
4
//! via `x.py dist hash-and-sign`; the cmdline arguments are set up
5
5
//! by rustbuild (in `src/bootstrap/dist.rs`).
6
6
7
+ #![ feature( try_blocks) ]
7
8
#![ deny( warnings) ]
8
9
9
10
use toml;
@@ -380,11 +381,14 @@ impl Builder {
380
381
/// If a tool does not pass its tests, don't ship it.
381
382
/// Right now, we do this only for Miri.
382
383
fn check_toolstate ( & mut self ) {
383
- // Get the toolstate for this rust revision.
384
- let toolstates = File :: open ( self . input . join ( "toolstates-linux.json" ) )
385
- . expect ( "failed to open toolstates file" ) ;
386
- let toolstates: HashMap < String , String > = serde_json:: from_reader ( & toolstates)
387
- . expect ( "toolstates file contains malformed JSON" ) ;
384
+ let toolstates: Option < HashMap < String , String > > = try {
385
+ let toolstates = File :: open ( self . input . join ( "toolstates-linux.json" ) ) . ok ( ) ?;
386
+ serde_json:: from_reader ( & toolstates) . ok ( ) ?
387
+ } ;
388
+ let toolstates = toolstates. unwrap_or_else ( || {
389
+ println ! ( "WARNING: `toolstates-linux.json` missing; assuming all tools failed" ) ;
390
+ HashMap :: default ( ) // Use empty map if anything went wrong.
391
+ } ) ;
388
392
// Mark some tools as missing based on toolstate.
389
393
if toolstates. get ( "miri" ) . map ( |s| & * s as & str ) != Some ( "test-pass" ) {
390
394
println ! ( "Miri tests are not passing, removing component" ) ;
You can’t perform that action at this time.
0 commit comments