use rustc_infer::infer::outlives::components::{push_outlives_components, Component};
use rustc_middle::ty::subst::{GenericArg, GenericArgKind};
-use rustc_middle::ty::{self, Region, RegionKind, Ty, TyCtxt};
+use rustc_middle::ty::{self, Region, Ty, TyCtxt};
use rustc_span::Span;
use smallvec::smallvec;
use std::collections::BTreeMap;
fn is_free_region(tcx: TyCtxt<'_>, region: Region<'_>) -> bool {
// First, screen for regions that might appear in a type header.
- match region {
+ match *region {
// These correspond to `T: 'a` relationships:
//
// struct Foo<'a, T> {
// }
//
// We care about these, so fall through.
- RegionKind::ReEarlyBound(_) => true,
+ ty::ReEarlyBound(_) => true,
// These correspond to `T: 'static` relationships which can be
// rather surprising. We are therefore putting this behind a
// struct Foo<'a, T> {
// field: &'static T, // this would generate a ReStatic
// }
- RegionKind::ReStatic => tcx.sess.features_untracked().infer_static_outlives_requirements,
+ ty::ReStatic => tcx.sess.features_untracked().infer_static_outlives_requirements,
// Late-bound regions can appear in `fn` types:
//
//
// The type above might generate a `T: 'b` bound, but we can
// ignore it. We can't put it on the struct header anyway.
- RegionKind::ReLateBound(..) => false,
+ ty::ReLateBound(..) => false,
// This can appear in `where Self: ` bounds (#64855):
//
// struct Bar<T>(<Self as Foo>::Type) where Self: ;
// struct Baz<'a>(&'a Self) where Self: ;
- RegionKind::ReEmpty(_) => false,
+ ty::ReEmpty(_) => false,
// These regions don't appear in types from type declarations:
- RegionKind::ReErased
- | RegionKind::ReVar(..)
- | RegionKind::RePlaceholder(..)
- | RegionKind::ReFree(..) => {
+ ty::ReErased | ty::ReVar(..) | ty::RePlaceholder(..) | ty::ReFree(..) => {
bug!("unexpected region in outlives inference: {:?}", region);
}
}