rustc/infer: miscellaneous minor code improvements

This commit is contained in:
ljedrz 2018-09-28 17:38:02 +02:00
parent 70eeb05441
commit 52da88639e
3 changed files with 6 additions and 8 deletions

View file

@ -406,10 +406,10 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
errors.clone()
} else {
errors
.iter()
.filter(|&e| !is_bound_failure(e))
.cloned()
.collect()
.iter()
.filter(|&e| !is_bound_failure(e))
.cloned()
.collect()
};
// sort the errors by span, for better error message stability.

View file

@ -147,9 +147,7 @@ impl<'cx, 'gcx, 'tcx> LexicalResolver<'cx, 'gcx, 'tcx> {
fn construct_var_data(&self, tcx: TyCtxt<'_, '_, 'tcx>) -> LexicalRegionResolutions<'tcx> {
LexicalRegionResolutions {
error_region: tcx.types.re_static,
values: (0..self.num_vars())
.map(|_| VarValue::Value(tcx.types.re_empty))
.collect(),
values: IndexVec::from_elem_n(VarValue::Value(tcx.types.re_empty), self.num_vars())
}
}

View file

@ -443,7 +443,7 @@ impl<'tcx> RegionConstraintCollector<'tcx> {
assert!(self.undo_log[snapshot.length] == OpenSnapshot);
if snapshot.length == 0 {
self.undo_log.truncate(0);
self.undo_log.clear();
} else {
(*self.undo_log)[snapshot.length] = CommitedSnapshot;
}