fn normalize_to_scc_representatives<T>(&self, tcx: TyCtxt<'tcx>, value: T) -> T
    where
        T: TypeFoldable<'tcx>,
    {
        tcx.fold_regions(&value, &mut false, |r, _db| {
            let vid = self.to_region_vid(r);
            let scc = self.constraint_sccs.scc(vid);
            let repr = self.scc_representatives[scc];
            tcx.mk_region(ty::ReVar(repr))
        })
    }
/// This is a conservative normalization procedure. It takes every
/// free region in `value` and replaces it with the
/// "representative" of its SCC (see `scc_representatives` field).
/// We are guaranteed that if two values normalize to the same
/// thing, then they are equal; this is a conservative check in
/// that they could still be equal even if they normalize to
/// different results. (For example, there might be two regions
/// with the same value that are not in the same SCC).
///
/// N.B., this is not an ideal approach and I would like to revisit
/// it. However, it works pretty well in practice. In particular,
/// this is needed to deal with projection outlives bounds like
///
///     <T as Foo<'0>>::Item: '1
///
/// In particular, this routine winds up being important when
/// there are bounds like `where <T as Foo<'a>>::Item: 'b` in the
/// environment. In this case, if we can show that `'0 == 'a`,
/// and that `'b: '1`, then we know that the clause is
/// satisfied. In such cases, particularly due to limitations of
/// the trait solver =), we usually wind up with a where-clause like
/// `T: Foo<'a>` in scope, which thus forces `'0 == 'a` to be added as
/// a constraint, and thus ensures that they are in the same SCC.
///
/// So why can't we do a more correct routine? Well, we could
/// *almost* use the `relate_tys` code, but the way it is
/// currently setup it creates inference variables to deal with
/// higher-ranked things and so forth, and right now the inference
/// context is not permitted to make more inference variables. So
/// we use this kind of hacky solution.
This is a conservative normalization procedure. It takes every
free region in `value` and replaces it with the
"representative" of its SCC .
We are guaranteed that if two values normalize to the same
thing, then they are equal; this is a conservative check in
that they could still be equal even if they normalize to
different results. (For example, there might be two regions
with the same value that are not in the same SCC).

N.B., this is not an ideal approach and I would like to revisit
it. However, it works pretty well in practice. In particular,
this is needed to deal with projection outlives bounds like



In particular, this routine winds up being important when
there are bounds like `where >::Item: 'b` in the
environment. In this case, if we can show that `'0 == 'a`,
and that `'b: '1`, then we know that the clause is
satisfied. In such cases, particularly due to limitations of
the trait solver =), we usually wind up with a where-clause like
`T: Foo<'a>` in scope, which thus forces `'0 == 'a` to be added as
a constraint, and thus ensures that they are in the same SCC.

So why can't we do a more correct routine. Well, we could
almost* use the `relate_tys` code, but the way it is
currently setup it creates inference variables to deal with
higher-ranked things and so forth, and right now the inference
context is not permitted to make more inference variables. So
we use this kind of hacky solution.
This is a conservative normalization procedure . It takes every free region in ` value ` and replaces it with the " representative " of its SCC . We are guaranteed that if two values normalize to the same thing then they are equal ; this is a conservative check in that they could still be equal even if they normalize to different results . ( For example there might be two regions with the same value that are not in the same SCC ) . N . B . this is not an ideal approach and I would like to revisit it . However it works pretty well in practice . In particular this is needed to deal with projection outlives bounds like In particular this routine winds up being important when there are bounds like ` where > :: Item : ' b ` in the environment . In this case if we can show that ` ' 0 == ' a ` and that ` ' b : ' 1 ` then we know that the clause is satisfied . In such cases particularly due to limitations of the trait solver = ) we usually wind up with a where - clause like ` T : Foo< ' a > ` in scope which thus forces ` ' 0 == ' a ` to be added as a constraint and thus ensures that they are in the same SCC . So why can ' t we do a more correct routine . Well we could almost * use the ` relate_tys ` code but the way it is currently setup it creates inference variables to deal with higher - ranked things and so forth and right now the inference context is not permitted to make more inference variables . So we use this kind of hacky solution .
fn normalize_to_scc_representatives<T>(&self, tcx: TyCtxt<'tcx>, value: T) -> T
    where
        T: TypeFoldable<'tcx>,
    {
        tcx.fold_regions(&value, &mut false, |r, _db| {
            let vid = self.to_region_vid(r);
            let scc = self.constraint_sccs.scc(vid);
            let repr = self.scc_representatives[scc];
            tcx.mk_region(ty::ReVar(repr))
        })
    }
fn normalize_to_scc_representatives < T > ( & self , tcx : TyCtxt < ' tcx > , value : T ) -> T where T : TypeFoldable < ' tcx > , { tcx . fold_regions ( & value , & mut false , | r , _db | { let vid = self . to_region_vid ( r ) ; let scc = self . constraint_sccs . scc ( vid ) ; let repr = self . scc_representatives [ scc ] ; tcx . mk_region ( ty :: ReVar ( repr ) ) } ) }
This is a conservative normalization procedure.
This is a conservative normalization procedure .
&self
tcx
TyCtxt<'tcx>
value
T