Skip to content

Commit

Permalink
Use question_mark feature in librustc_incremental.
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmedcharles committed Sep 11, 2016
1 parent 8391760 commit 8a9e52a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/librustc_incremental/persist/hash.rs
Expand Up @@ -194,15 +194,15 @@ impl<'a, 'tcx> HashContext<'a, 'tcx> {

// Load up the hashes for the def-ids from this crate.
let mut decoder = Decoder::new(data, 0);
let svh_in_hashes_file = try!(Svh::decode(&mut decoder));
let svh_in_hashes_file = Svh::decode(&mut decoder)?;

if svh_in_hashes_file != expected_svh {
// We should not be able to get here. If we do, then
// `fs::find_metadata_hashes_for()` has messed up.
bug!("mismatch between SVH in crate and SVH in incr. comp. hashes")
}

let serialized_hashes = try!(SerializedMetadataHashes::decode(&mut decoder));
let serialized_hashes = SerializedMetadataHashes::decode(&mut decoder)?;
for serialized_hash in serialized_hashes.hashes {
// the hashes are stored with just a def-index, which is
// always relative to the old crate; convert that to use
Expand Down
8 changes: 4 additions & 4 deletions src/librustc_incremental/persist/load.rs
Expand Up @@ -125,11 +125,11 @@ pub fn decode_dep_graph<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
{
// Decode the list of work_products
let mut work_product_decoder = Decoder::new(work_products_data, 0);
let work_products = try!(<Vec<SerializedWorkProduct>>::decode(&mut work_product_decoder));
let work_products = <Vec<SerializedWorkProduct>>::decode(&mut work_product_decoder)?;

// Deserialize the directory and dep-graph.
let mut dep_graph_decoder = Decoder::new(dep_graph_data, 0);
let prev_commandline_args_hash = try!(u64::decode(&mut dep_graph_decoder));
let prev_commandline_args_hash = u64::decode(&mut dep_graph_decoder)?;

if prev_commandline_args_hash != tcx.sess.opts.dep_tracking_hash() {
// We can't reuse the cache, purge it.
Expand All @@ -142,8 +142,8 @@ pub fn decode_dep_graph<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
return Ok(());
}

let directory = try!(DefIdDirectory::decode(&mut dep_graph_decoder));
let serialized_dep_graph = try!(SerializedDepGraph::decode(&mut dep_graph_decoder));
let directory = DefIdDirectory::decode(&mut dep_graph_decoder)?;
let serialized_dep_graph = SerializedDepGraph::decode(&mut dep_graph_decoder)?;

// Retrace the paths in the directory to find their current location (if any).
let retraced = directory.retrace(tcx);
Expand Down
10 changes: 5 additions & 5 deletions src/librustc_incremental/persist/save.rs
Expand Up @@ -110,7 +110,7 @@ pub fn encode_dep_graph(preds: &Predecessors,
-> io::Result<()> {
// First encode the commandline arguments hash
let tcx = builder.tcx();
try!(tcx.sess.opts.dep_tracking_hash().encode(encoder));
tcx.sess.opts.dep_tracking_hash().encode(encoder)?;

// Create a flat list of (Input, WorkProduct) edges for
// serialization.
Expand Down Expand Up @@ -149,8 +149,8 @@ pub fn encode_dep_graph(preds: &Predecessors,
debug!("graph = {:#?}", graph);

// Encode the directory and then the graph data.
try!(builder.directory().encode(encoder));
try!(graph.encode(encoder));
builder.directory().encode(encoder)?;
graph.encode(encoder)?;

Ok(())
}
Expand Down Expand Up @@ -222,8 +222,8 @@ pub fn encode_metadata_hashes(tcx: TyCtxt,
}

// Encode everything.
try!(svh.encode(encoder));
try!(serialized_hashes.encode(encoder));
svh.encode(encoder)?;
serialized_hashes.encode(encoder)?;

Ok(())
}
Expand Down

0 comments on commit 8a9e52a

Please sign in to comment.