- /// Pushes onto `out` the regions directly referenced from this type (but not
- /// types reachable from this type via `walk_tys`). This ignores late-bound
- /// regions binders.
- pub fn push_regions(&self, out: &mut SmallVec<[ty::Region<'tcx>; 4]>) {
- match self.kind {
- Ref(region, _, _) => {
- out.push(region);
- }
- Dynamic(ref obj, region) => {
- out.push(region);
- if let Some(principal) = obj.principal() {
- out.extend(principal.skip_binder().substs.regions());
- }
- }
- Adt(_, substs) | Opaque(_, substs) => out.extend(substs.regions()),
- Closure(_, ref substs) | Generator(_, ref substs, _) => out.extend(substs.regions()),
- Projection(ref data) | UnnormalizedProjection(ref data) => {
- out.extend(data.substs.regions())
- }
- FnDef(..) | FnPtr(_) | GeneratorWitness(..) | Bool | Char | Int(_) | Uint(_)
- | Float(_) | Str | Array(..) | Slice(_) | RawPtr(_) | Never | Tuple(..)
- | Foreign(..) | Param(_) | Bound(..) | Placeholder(..) | Infer(_) | Error => {}
- }
- }
-