Skip to content

Commit 8a9e52a

Browse files
committed
Use question_mark feature in librustc_incremental.
1 parent 8391760 commit 8a9e52a

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

src/librustc_incremental/persist/hash.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,15 +194,15 @@ impl<'a, 'tcx> HashContext<'a, 'tcx> {
194194

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

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

205-
let serialized_hashes = try!(SerializedMetadataHashes::decode(&mut decoder));
205+
let serialized_hashes = SerializedMetadataHashes::decode(&mut decoder)?;
206206
for serialized_hash in serialized_hashes.hashes {
207207
// the hashes are stored with just a def-index, which is
208208
// always relative to the old crate; convert that to use

src/librustc_incremental/persist/load.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,11 @@ pub fn decode_dep_graph<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
125125
{
126126
// Decode the list of work_products
127127
let mut work_product_decoder = Decoder::new(work_products_data, 0);
128-
let work_products = try!(<Vec<SerializedWorkProduct>>::decode(&mut work_product_decoder));
128+
let work_products = <Vec<SerializedWorkProduct>>::decode(&mut work_product_decoder)?;
129129

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

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

145-
let directory = try!(DefIdDirectory::decode(&mut dep_graph_decoder));
146-
let serialized_dep_graph = try!(SerializedDepGraph::decode(&mut dep_graph_decoder));
145+
let directory = DefIdDirectory::decode(&mut dep_graph_decoder)?;
146+
let serialized_dep_graph = SerializedDepGraph::decode(&mut dep_graph_decoder)?;
147147

148148
// Retrace the paths in the directory to find their current location (if any).
149149
let retraced = directory.retrace(tcx);

src/librustc_incremental/persist/save.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ pub fn encode_dep_graph(preds: &Predecessors,
110110
-> io::Result<()> {
111111
// First encode the commandline arguments hash
112112
let tcx = builder.tcx();
113-
try!(tcx.sess.opts.dep_tracking_hash().encode(encoder));
113+
tcx.sess.opts.dep_tracking_hash().encode(encoder)?;
114114

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

151151
// Encode the directory and then the graph data.
152-
try!(builder.directory().encode(encoder));
153-
try!(graph.encode(encoder));
152+
builder.directory().encode(encoder)?;
153+
graph.encode(encoder)?;
154154

155155
Ok(())
156156
}
@@ -222,8 +222,8 @@ pub fn encode_metadata_hashes(tcx: TyCtxt,
222222
}
223223

224224
// Encode everything.
225-
try!(svh.encode(encoder));
226-
try!(serialized_hashes.encode(encoder));
225+
svh.encode(encoder)?;
226+
serialized_hashes.encode(encoder)?;
227227

228228
Ok(())
229229
}

0 commit comments

Comments
 (0)