@@ -820,10 +820,10 @@ fn contains_illegal_self_type_reference<'tcx, T: TypeFoldable<'tcx>>(
820
820
}
821
821
}
822
822
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 > {
827
827
// Constants can only influence object safety if they reference `Self`.
828
828
// This is only possible for unevaluated constants, so we walk these here.
829
829
//
@@ -837,7 +837,7 @@ fn contains_illegal_self_type_reference<'tcx, T: TypeFoldable<'tcx>>(
837
837
// This shouldn't really matter though as we can't really use any
838
838
// constants which are not considered const evaluatable.
839
839
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 ( ) ) {
841
841
const_evaluatable:: walk_abstract_const ( self . tcx , ct, |node| match node. root ( ) {
842
842
Node :: Leaf ( leaf) => {
843
843
let leaf = leaf. subst ( self . tcx , ct. substs ) ;
@@ -852,31 +852,6 @@ fn contains_illegal_self_type_reference<'tcx, T: TypeFoldable<'tcx>>(
852
852
ControlFlow :: CONTINUE
853
853
}
854
854
}
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
- }
880
855
}
881
856
882
857
value
0 commit comments