From 8a9e52a8e734972b9b16cbfc3902743eb432cfbc Mon Sep 17 00:00:00 2001 From: Ahmed Charles Date: Sat, 27 Aug 2016 02:31:17 -0700 Subject: [PATCH] Use question_mark feature in librustc_incremental. --- src/librustc_incremental/persist/hash.rs | 4 ++-- src/librustc_incremental/persist/load.rs | 8 ++++---- src/librustc_incremental/persist/save.rs | 10 +++++----- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/librustc_incremental/persist/hash.rs b/src/librustc_incremental/persist/hash.rs index 95bee669d32..bafaafd4afa 100644 --- a/src/librustc_incremental/persist/hash.rs +++ b/src/librustc_incremental/persist/hash.rs @@ -194,7 +194,7 @@ 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 @@ -202,7 +202,7 @@ impl<'a, 'tcx> HashContext<'a, 'tcx> { 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 diff --git a/src/librustc_incremental/persist/load.rs b/src/librustc_incremental/persist/load.rs index 48f95430f26..6e6464e4968 100644 --- a/src/librustc_incremental/persist/load.rs +++ b/src/librustc_incremental/persist/load.rs @@ -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!(>::decode(&mut work_product_decoder)); + let work_products = >::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. @@ -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); diff --git a/src/librustc_incremental/persist/save.rs b/src/librustc_incremental/persist/save.rs index d31252be5e8..41212d8e138 100644 --- a/src/librustc_incremental/persist/save.rs +++ b/src/librustc_incremental/persist/save.rs @@ -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. @@ -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(()) } @@ -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(()) }