1
Fork 0

Eliminate ObligationCauseData.

This makes `Obligation` two words bigger, but avoids allocating a lot of
the time.

I previously tried this in #73983 and it didn't help much, but local
timings look more promising now.
This commit is contained in:
Nicholas Nethercote 2021-11-11 12:01:12 +11:00 committed by Nicholas Nethercote
parent e95e084a14
commit f09b1facd0
22 changed files with 135 additions and 139 deletions

View file

@ -232,7 +232,7 @@ pub fn predicates_for_generics<'tcx>(
debug!("predicates_for_generics(generic_bounds={:?})", generic_bounds);
iter::zip(generic_bounds.predicates, generic_bounds.spans).map(move |(predicate, span)| {
let cause = match cause.code {
let cause = match *cause.code() {
traits::ItemObligation(def_id) if !span.is_dummy() => traits::ObligationCause::new(
cause.span,
cause.body_id,