rustc/ty: improve allocations
This commit is contained in:
parent
db171649d3
commit
04b99bc103
@ -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)));
|
||||
}
|
||||
|
@ -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());
|
||||
|
@ -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(
|
||||
|
Loading…
Reference in New Issue
Block a user