diff options
| author | scalexm <alexandre@scalexm.fr> | 2018-10-13 17:10:56 +0200 |
|---|---|---|
| committer | scalexm <alexandre@scalexm.fr> | 2018-10-17 14:12:46 +0200 |
| commit | 55ce7a266958aaed4774927ed1765576f561aa2d (patch) | |
| tree | ce220ddc655a78264575163e9d4552040ad4c3ac | |
| parent | 7ec8269d0aead891c25a20b4e4c4cc5d73eccf79 (diff) | |
| download | rust-55ce7a266958aaed4774927ed1765576f561aa2d.tar.gz rust-55ce7a266958aaed4774927ed1765576f561aa2d.zip | |
Re-use memory in `program_clauses_for_env`
| -rw-r--r-- | src/librustc/ich/impls_ty.rs | 3 | ||||
| -rw-r--r-- | src/librustc_traits/lowering/environment.rs | 10 |
2 files changed, 5 insertions, 8 deletions
diff --git a/src/librustc/ich/impls_ty.rs b/src/librustc/ich/impls_ty.rs index 36c0f30f0bf..43448ad0d15 100644 --- a/src/librustc/ich/impls_ty.rs +++ b/src/librustc/ich/impls_ty.rs @@ -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 diff --git a/src/librustc_traits/lowering/environment.rs b/src/librustc_traits/lowering/environment.rs index f0ce2037723..3d1e7cf17a6 100644 --- a/src/librustc_traits/lowering/environment.rs +++ b/src/librustc_traits/lowering/environment.rs @@ -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>>, } @@ -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); |
