]> git.proxmox.com Git - rustc.git/blobdiff - src/librustc/infer/canonical/canonicalizer.rs
New upstream version 1.41.1+dfsg1
[rustc.git] / src / librustc / infer / canonical / canonicalizer.rs
index 49a2c90bdbf603e37bf28edbafbb3c68781892f0..1fa814dc14efb52702a778007b3f6305946f5862 100644 (file)
@@ -10,7 +10,6 @@ use crate::infer::canonical::{
     OriginalQueryValues,
 };
 use crate::infer::InferCtxt;
-use crate::mir::interpret::ConstValue;
 use std::sync::atomic::Ordering;
 use crate::ty::fold::{TypeFoldable, TypeFolder};
 use crate::ty::subst::GenericArg;
@@ -307,7 +306,7 @@ impl<'cx, 'tcx> TypeFolder<'tcx> for Canonicalizer<'cx, 'tcx> {
         match *r {
             ty::ReLateBound(index, ..) => {
                 if index >= self.binder_index {
-                    bug!("escaping late bound region during canonicalization")
+                    bug!("escaping late-bound region during canonicalization");
                 } else {
                     r
                 }
@@ -337,7 +336,7 @@ impl<'cx, 'tcx> TypeFolder<'tcx> for Canonicalizer<'cx, 'tcx> {
                 .canonicalize_free_region(self, r),
 
             ty::ReClosureBound(..) => {
-                bug!("closure bound region encountered during canonicalization")
+                bug!("closure bound region encountered during canonicalization");
             }
         }
     }
@@ -347,14 +346,14 @@ impl<'cx, 'tcx> TypeFolder<'tcx> for Canonicalizer<'cx, 'tcx> {
             ty::Infer(ty::TyVar(vid)) => {
                 debug!("canonical: type var found with vid {:?}", vid);
                 match self.infcx.unwrap().probe_ty_var(vid) {
-                    // `t` could be a float / int variable: canonicalize that instead
+                    // `t` could be a float / int variable; canonicalize that instead.
                     Ok(t) => {
                         debug!("(resolved to {:?})", t);
                         self.fold_ty(t)
                     }
 
                     // `TyVar(vid)` is unresolved, track its universe index in the canonicalized
-                    // result
+                    // result.
                     Err(mut ui) => {
                         if !self.infcx.unwrap().tcx.sess.opts.debugging_opts.chalk {
                             // FIXME: perf problem described in #55921.
@@ -441,7 +440,7 @@ impl<'cx, 'tcx> TypeFolder<'tcx> for Canonicalizer<'cx, 'tcx> {
 
     fn fold_const(&mut self, ct: &'tcx ty::Const<'tcx>) -> &'tcx ty::Const<'tcx> {
         match ct.val {
-            ConstValue::Infer(InferConst::Var(vid)) => {
+            ty::ConstKind::Infer(InferConst::Var(vid)) => {
                 debug!("canonical: const var found with vid {:?}", vid);
                 match self.infcx.unwrap().probe_const_var(vid) {
                     Ok(c) => {
@@ -465,17 +464,17 @@ impl<'cx, 'tcx> TypeFolder<'tcx> for Canonicalizer<'cx, 'tcx> {
                     }
                 }
             }
-            ConstValue::Infer(InferConst::Fresh(_)) => {
+            ty::ConstKind::Infer(InferConst::Fresh(_)) => {
                 bug!("encountered a fresh const during canonicalization")
             }
-            ConstValue::Bound(debruijn, _) => {
+            ty::ConstKind::Bound(debruijn, _) => {
                 if debruijn >= self.binder_index {
                     bug!("escaping bound type during canonicalization")
                 } else {
                     return ct;
                 }
             }
-            ConstValue::Placeholder(placeholder) => {
+            ty::ConstKind::Placeholder(placeholder) => {
                 return self.canonicalize_const_var(
                     CanonicalVarInfo {
                         kind: CanonicalVarKind::PlaceholderConst(placeholder),
@@ -700,7 +699,7 @@ impl<'cx, 'tcx> Canonicalizer<'cx, 'tcx> {
             let var = self.canonical_var(info, const_var.into());
             self.tcx().mk_const(
                 ty::Const {
-                    val: ConstValue::Bound(self.binder_index, var.into()),
+                    val: ty::ConstKind::Bound(self.binder_index, var.into()),
                     ty: self.fold_ty(const_var.ty),
                 }
             )