@@ -820,10 +820,10 @@ fn contains_illegal_self_type_reference<'tcx, T: TypeFoldable<'tcx>>(
820820 }
821821 }
822822
823- fn visit_const ( & mut self , ct : & ty :: Const < ' tcx > ) -> ControlFlow < Self :: BreakTy > {
824- // First check if the type of this constant references `Self`.
825- self . visit_ty ( ct . ty ) ? ;
826-
823+ fn visit_unevaluated_const (
824+ & mut self ,
825+ uv : ty :: Unevaluated < ' tcx > ,
826+ ) -> ControlFlow < Self :: BreakTy > {
827827 // Constants can only influence object safety if they reference `Self`.
828828 // This is only possible for unevaluated constants, so we walk these here.
829829 //
@@ -837,7 +837,7 @@ fn contains_illegal_self_type_reference<'tcx, T: TypeFoldable<'tcx>>(
837837 // This shouldn't really matter though as we can't really use any
838838 // constants which are not considered const evaluatable.
839839 use rustc_middle:: mir:: abstract_const:: Node ;
840- if let Ok ( Some ( ct) ) = AbstractConst :: from_const ( self . tcx , ct ) {
840+ if let Ok ( Some ( ct) ) = AbstractConst :: new ( self . tcx , uv . shrink ( ) ) {
841841 const_evaluatable:: walk_abstract_const ( self . tcx , ct, |node| match node. root ( ) {
842842 Node :: Leaf ( leaf) => {
843843 let leaf = leaf. subst ( self . tcx , ct. substs ) ;
@@ -852,31 +852,6 @@ fn contains_illegal_self_type_reference<'tcx, T: TypeFoldable<'tcx>>(
852852 ControlFlow :: CONTINUE
853853 }
854854 }
855-
856- fn visit_predicate ( & mut self , pred : ty:: Predicate < ' tcx > ) -> ControlFlow < Self :: BreakTy > {
857- if let ty:: PredicateKind :: ConstEvaluatable ( ct) = pred. kind ( ) . skip_binder ( ) {
858- // FIXME(generic_const_exprs): We should probably deduplicate the logic for
859- // `AbstractConst`s here, it might make sense to change `ConstEvaluatable` to
860- // take a `ty::Const` instead.
861- use rustc_middle:: mir:: abstract_const:: Node ;
862- if let Ok ( Some ( ct) ) = AbstractConst :: new ( self . tcx , ct) {
863- const_evaluatable:: walk_abstract_const ( self . tcx , ct, |node| match node. root ( ) {
864- Node :: Leaf ( leaf) => {
865- let leaf = leaf. subst ( self . tcx , ct. substs ) ;
866- self . visit_const ( leaf)
867- }
868- Node :: Cast ( _, _, ty) => self . visit_ty ( ty) ,
869- Node :: Binop ( ..) | Node :: UnaryOp ( ..) | Node :: FunctionCall ( _, _) => {
870- ControlFlow :: CONTINUE
871- }
872- } )
873- } else {
874- ControlFlow :: CONTINUE
875- }
876- } else {
877- pred. super_visit_with ( self )
878- }
879- }
880855 }
881856
882857 value
0 commit comments