Skip to content

Commit

Permalink
Re-use memory in program_clauses_for_env
Browse files Browse the repository at this point in the history
  • Loading branch information
scalexm committed Oct 17, 2018
1 parent 7ec8269 commit 55ce7a2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
3 changes: 0 additions & 3 deletions src/librustc/ich/impls_ty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1424,15 +1424,12 @@ impl_stable_hash_for!(enum traits::QuantifierKind {
Existential
});

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

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

=======
impl_stable_hash_for!(
impl<'tcx> for struct traits::Environment<'tcx> {
clauses,
}
);
>>>>>>> Use `Environment` instead of `ty::ParamEnv` in chalk context
10 changes: 5 additions & 5 deletions src/librustc_traits/lowering/environment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use rustc::ty::{self, TyCtxt, Ty};
use rustc::hir::def_id::DefId;
use rustc_data_structures::fx::FxHashSet;

struct ClauseVisitor<'set, 'a, 'tcx: 'a> {
struct ClauseVisitor<'set, 'a, 'tcx: 'a + 'set> {
tcx: TyCtxt<'a, 'tcx, 'tcx>,
round: &'set mut FxHashSet<Clause<'tcx>>,
}
Expand Down Expand Up @@ -154,12 +154,12 @@ crate fn program_clauses_for_env<'a, 'tcx>(
let mut next_round = FxHashSet();
while !last_round.is_empty() {
let mut visitor = ClauseVisitor::new(tcx, &mut next_round);
for clause in last_round {
for clause in last_round.drain() {
visitor.visit_clause(clause);
}
last_round = next_round.drain()
.filter(|&clause| closure.insert(clause))
.collect();
last_round.extend(
next_round.drain().filter(|&clause| closure.insert(clause))
);
}

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

0 comments on commit 55ce7a2

Please sign in to comment.