@@ -813,9 +813,10 @@ fn contains_illegal_self_type_reference<'tcx, T: TypeFoldable<'tcx>>(
813
813
}
814
814
}
815
815
816
- fn visit_const ( & mut self , ct : & ' tcx ty:: Const < ' tcx > ) -> ControlFlow < Self :: BreakTy > {
817
- self . visit_ty ( ct. ty ) ?;
818
-
816
+ fn visit_unevaluated_const (
817
+ & mut self ,
818
+ uv : ty:: Unevaluated < ' tcx > ,
819
+ ) -> ControlFlow < Self :: BreakTy > {
819
820
// Constants can only influence object safety if they reference `Self`.
820
821
// This is only possible for unevaluated constants, so we walk these here.
821
822
//
@@ -829,7 +830,7 @@ fn contains_illegal_self_type_reference<'tcx, T: TypeFoldable<'tcx>>(
829
830
// This shouldn't really matter though as we can't really use any
830
831
// constants which are not considered const evaluatable.
831
832
use rustc_middle:: thir:: abstract_const:: Node ;
832
- if let Ok ( Some ( ct) ) = AbstractConst :: from_const ( self . tcx , ct ) {
833
+ if let Ok ( Some ( ct) ) = AbstractConst :: new ( self . tcx , uv . shrink ( ) ) {
833
834
const_evaluatable:: walk_abstract_const ( self . tcx , ct, |node| {
834
835
match node. root ( self . tcx ) {
835
836
Node :: Leaf ( leaf) => self . visit_const ( leaf) ,
@@ -843,30 +844,6 @@ fn contains_illegal_self_type_reference<'tcx, T: TypeFoldable<'tcx>>(
843
844
ControlFlow :: CONTINUE
844
845
}
845
846
}
846
-
847
- fn visit_predicate ( & mut self , pred : ty:: Predicate < ' tcx > ) -> ControlFlow < Self :: BreakTy > {
848
- if let ty:: PredicateKind :: ConstEvaluatable ( uv) = pred. kind ( ) . skip_binder ( ) {
849
- // FIXME(generic_const_exprs): We should probably deduplicate the logic for
850
- // `AbstractConst`s here, it might make sense to change `ConstEvaluatable` to
851
- // take a `ty::Const` instead.
852
- use rustc_middle:: thir:: abstract_const:: Node ;
853
- if let Ok ( Some ( ct) ) = AbstractConst :: new ( self . tcx , uv) {
854
- const_evaluatable:: walk_abstract_const ( self . tcx , ct, |node| {
855
- match node. root ( self . tcx ) {
856
- Node :: Leaf ( leaf) => self . visit_const ( leaf) ,
857
- Node :: Cast ( _, _, ty) => self . visit_ty ( ty) ,
858
- Node :: Binop ( ..) | Node :: UnaryOp ( ..) | Node :: FunctionCall ( _, _) => {
859
- ControlFlow :: CONTINUE
860
- }
861
- }
862
- } )
863
- } else {
864
- ControlFlow :: CONTINUE
865
- }
866
- } else {
867
- pred. super_visit_with ( self )
868
- }
869
- }
870
847
}
871
848
872
849
value
0 commit comments