Skip to content

Commit

Permalink
Don't collect into a Vec that is immediately being iterated on again.
Browse files Browse the repository at this point in the history
  • Loading branch information
oli-obk committed Aug 10, 2021
1 parent 7af445d commit 93c4aa8
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions compiler/rustc_trait_selection/src/opaque_types.rs
Expand Up @@ -344,12 +344,11 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
// check.)
let bounds = tcx.explicit_item_bounds(def_id);
debug!("{:#?}", bounds);
let bounds: Vec<_> =
bounds.iter().map(|(bound, _)| bound.subst(tcx, opaque_type_key.substs)).collect();
let bounds = bounds.iter().map(|(bound, _)| bound.subst(tcx, opaque_type_key.substs));
debug!("{:#?}", bounds);
let opaque_type = tcx.mk_opaque(def_id, opaque_type_key.substs);

let required_region_bounds = required_region_bounds(tcx, opaque_type, bounds.into_iter());
let required_region_bounds = required_region_bounds(tcx, opaque_type, bounds);
if !required_region_bounds.is_empty() {
for required_region in required_region_bounds {
concrete_ty.visit_with(&mut ConstrainOpaqueTypeRegionVisitor {
Expand Down

0 comments on commit 93c4aa8

Please sign in to comment.