Skip to content

Commit

Permalink
rustc/ty: improve allocations
Browse files Browse the repository at this point in the history
  • Loading branch information
ljedrz committed Oct 3, 2018
1 parent db17164 commit 04b99bc
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
6 changes: 1 addition & 5 deletions src/librustc/ty/outlives.rs
Expand Up @@ -180,9 +180,5 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
}

fn push_region_constraints<'tcx>(out: &mut Vec<Component<'tcx>>, regions: Vec<ty::Region<'tcx>>) {
for r in regions {
if !r.is_late_bound() {
out.push(Component::Region(r));
}
}
out.extend(regions.iter().filter(|&r| !r.is_late_bound()).map(|r| Component::Region(r)));
}
1 change: 1 addition & 0 deletions src/librustc/ty/subst.rs
Expand Up @@ -229,6 +229,7 @@ impl<'a, 'gcx, 'tcx> Substs<'tcx> {
mk_kind: &mut F)
where F: FnMut(&ty::GenericParamDef, &[Kind<'tcx>]) -> Kind<'tcx>
{
substs.reserve(defs.params.len());
for param in &defs.params {
let kind = mk_kind(param, substs);
assert_eq!(param.index as usize, substs.len());
Expand Down
1 change: 1 addition & 0 deletions src/librustc/ty/wf.rs
Expand Up @@ -493,6 +493,7 @@ impl<'a, 'gcx, 'tcx> WfPredicates<'a, 'gcx, 'tcx> {

let explicit_bound = region;

self.out.reserve(implicit_bounds.len());
for implicit_bound in implicit_bounds {
let cause = self.cause(traits::ObjectTypeBound(ty, explicit_bound));
let outlives = ty::Binder::dummy(
Expand Down

0 comments on commit 04b99bc

Please sign in to comment.