]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc/ty/structural_impls.rs
Rollup merge of #61217 - estebank:issue-52820, r=Centril
[rust.git] / src / librustc / ty / structural_impls.rs
index 35d0359dbcfd255406490a2a3a12a7610c3ea2ba..0daa567052d5662ec881cad2b4c366f30b6c5ca4 100644 (file)
@@ -6,7 +6,7 @@
 use crate::hir::def::Namespace;
 use crate::mir::ProjectionKind;
 use crate::mir::interpret::ConstValue;
-use crate::ty::{self, Lift, Ty, TyCtxt, ConstVid, InferConst};
+use crate::ty::{self, Lift, Ty, TyCtxt, InferConst};
 use crate::ty::fold::{TypeFoldable, TypeFolder, TypeVisitor};
 use crate::ty::print::{FmtPrinter, Printer};
 use rustc_data_structures::indexed_vec::{IndexVec, Idx};
@@ -14,7 +14,6 @@
 use crate::mir::interpret;
 
 use std::fmt;
-use std::marker::PhantomData;
 use std::rc::Rc;
 
 impl fmt::Debug for ty::GenericParamDef {
@@ -295,9 +294,6 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
     (),
     bool,
     usize,
-    u32,
-    crate::ty::BoundVar,
-    crate::ty::DebruijnIndex,
     crate::ty::layout::VariantIdx,
     u64,
     String,
@@ -314,8 +310,6 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
     ::rustc_target::spec::abi::Abi,
     crate::mir::Local,
     crate::mir::Promoted,
-    crate::mir::interpret::Scalar,
-    crate::mir::interpret::Pointer,
     crate::traits::Reveal,
     crate::ty::adjustment::AutoBorrowMutability,
     crate::ty::AdtKind,
@@ -793,44 +787,6 @@ impl<'a, 'tcx> Lift<'tcx> for interpret::GlobalId<'a> {
     }
 }
 
-BraceStructLiftImpl! {
-    impl<'a, 'tcx> Lift<'tcx> for ty::Const<'a> {
-        type Lifted = ty::Const<'tcx>;
-        val, ty
-    }
-}
-
-EnumLiftImpl! {
-    impl<'a, 'tcx> Lift<'tcx> for interpret::ConstValue<'a> {
-        type Lifted = interpret::ConstValue<'tcx>;
-        (interpret::ConstValue::Unevaluated)(a, b),
-        (interpret::ConstValue::Param)(a),
-        (interpret::ConstValue::Infer)(a),
-        (interpret::ConstValue::Scalar)(a),
-        (interpret::ConstValue::Slice)(a, b),
-        (interpret::ConstValue::ByRef)(a, b),
-    }
-}
-
-EnumLiftImpl! {
-    impl<'a, 'tcx> Lift<'tcx> for ty::InferConst<'a> {
-        type Lifted = ty::InferConst<'tcx>;
-        (ty::InferConst::Var)(a),
-        (ty::InferConst::Fresh)(a),
-        (ty::InferConst::Canonical)(a, b),
-    }
-}
-
-impl<'a, 'tcx> Lift<'tcx> for ConstVid<'a> {
-    type Lifted = ConstVid<'tcx>;
-    fn lift_to_tcx<'b, 'gcx>(&self, _: TyCtxt<'b, 'gcx, 'tcx>) -> Option<Self::Lifted> {
-        Some(ConstVid {
-            index: self.index,
-            phantom: PhantomData,
-        })
-    }
-}
-
 ///////////////////////////////////////////////////////////////////////////
 // TypeFoldable implementations.
 //
@@ -1389,7 +1345,7 @@ fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F)
             ConstValue::Param(p) => ConstValue::Param(p.fold_with(folder)),
             ConstValue::Placeholder(p) => ConstValue::Placeholder(p),
             ConstValue::Scalar(a) => ConstValue::Scalar(a),
-            ConstValue::Slice(a, b) => ConstValue::Slice(a, b),
+            ConstValue::Slice { data, start, end } => ConstValue::Slice { data, start, end },
             ConstValue::Unevaluated(did, substs)
                 => ConstValue::Unevaluated(did, substs.fold_with(folder)),
         }
@@ -1402,7 +1358,7 @@ fn super_visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> bool {
             ConstValue::Param(p) => p.visit_with(visitor),
             ConstValue::Placeholder(_) => false,
             ConstValue::Scalar(_) => false,
-            ConstValue::Slice(..) => false,
+            ConstValue::Slice { .. } => false,
             ConstValue::Unevaluated(_, substs) => substs.visit_with(visitor),
         }
     }