Skip to content

Commit 55ce7a2

Browse files
committed
Re-use memory in program_clauses_for_env
1 parent 7ec8269 commit 55ce7a2

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

src/librustc/ich/impls_ty.rs

-3
Original file line numberDiff line numberDiff line change
@@ -1424,15 +1424,12 @@ impl_stable_hash_for!(enum traits::QuantifierKind {
14241424
Existential
14251425
});
14261426

1427-
<<<<<<< HEAD
14281427
impl_stable_hash_for!(struct ty::subst::UserSubsts<'tcx> { substs, user_self_ty });
14291428

14301429
impl_stable_hash_for!(struct ty::subst::UserSelfTy<'tcx> { impl_def_id, self_ty });
14311430

1432-
=======
14331431
impl_stable_hash_for!(
14341432
impl<'tcx> for struct traits::Environment<'tcx> {
14351433
clauses,
14361434
}
14371435
);
1438-
>>>>>>> Use `Environment` instead of `ty::ParamEnv` in chalk context

src/librustc_traits/lowering/environment.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use rustc::ty::{self, TyCtxt, Ty};
2121
use rustc::hir::def_id::DefId;
2222
use rustc_data_structures::fx::FxHashSet;
2323

24-
struct ClauseVisitor<'set, 'a, 'tcx: 'a> {
24+
struct ClauseVisitor<'set, 'a, 'tcx: 'a + 'set> {
2525
tcx: TyCtxt<'a, 'tcx, 'tcx>,
2626
round: &'set mut FxHashSet<Clause<'tcx>>,
2727
}
@@ -154,12 +154,12 @@ crate fn program_clauses_for_env<'a, 'tcx>(
154154
let mut next_round = FxHashSet();
155155
while !last_round.is_empty() {
156156
let mut visitor = ClauseVisitor::new(tcx, &mut next_round);
157-
for clause in last_round {
157+
for clause in last_round.drain() {
158158
visitor.visit_clause(clause);
159159
}
160-
last_round = next_round.drain()
161-
.filter(|&clause| closure.insert(clause))
162-
.collect();
160+
last_round.extend(
161+
next_round.drain().filter(|&clause| closure.insert(clause))
162+
);
163163
}
164164

165165
debug!("program_clauses_for_env: closure = {:#?}", closure);

0 commit comments

Comments
 (0)