]> git.proxmox.com Git - rustc.git/blobdiff - compiler/rustc_typeck/src/outlives/utils.rs
New upstream version 1.60.0+dfsg1
[rustc.git] / compiler / rustc_typeck / src / outlives / utils.rs
index 76ae2ee43566e9d0ac28a7cf6c49fca342159d70..54a5037b57578da53aef14b2d097af3ddc51556b 100644 (file)
@@ -1,6 +1,6 @@
 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;
@@ -133,7 +133,7 @@ pub fn insert_outlives_predicate<'tcx>(
 
 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> {
@@ -141,7 +141,7 @@ fn is_free_region(tcx: TyCtxt<'_>, region: Region<'_>) -> bool {
         //     }
         //
         // 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
@@ -150,7 +150,7 @@ fn is_free_region(tcx: TyCtxt<'_>, region: Region<'_>) -> bool {
         //     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:
         //
@@ -160,19 +160,16 @@ fn is_free_region(tcx: TyCtxt<'_>, region: Region<'_>) -> bool {
         //
         // 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);
         }
     }