Skip to content

Commit

Permalink
Push to result vector instead of allocating
Browse files Browse the repository at this point in the history
Co-authored-by: lcnr <bastian_kauschke@hotmail.de>
  • Loading branch information
bugadani and lcnr committed Nov 13, 2020
1 parent 45faeb4 commit f0d0d87
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
2 changes: 1 addition & 1 deletion compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ impl CStore {

let span = data.get_span(id.index, sess);

let attrs: Vec<_> = data.get_item_attrs(id.index, sess).collect();
let attrs = data.get_item_attrs(id.index, sess).collect();

let ident = data.item_ident(id.index, sess);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -353,16 +353,13 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
all_bounds.filter(|p| p.def_id() == stack.obligation.predicate.def_id());

// Keep only those bounds which may apply, and propagate overflow if it occurs.
let mut param_candidates = vec![];
for bound in matching_bounds {
let wc = self.evaluate_where_clause(stack, bound)?;
if wc.may_apply() {
param_candidates.push(ParamCandidate(bound));
candidates.vec.push(ParamCandidate(bound));
}
}

candidates.vec.extend(param_candidates);

Ok(())
}

Expand Down

0 comments on commit f0d0d87

Please sign in to comment.