@@ -837,24 +837,14 @@ fn contains_illegal_self_type_reference<'tcx, T: TypeVisitable<'tcx>>(
837
837
}
838
838
}
839
839
840
- fn visit_ty_unevaluated (
841
- & mut self ,
842
- uv : ty:: UnevaluatedConst < ' tcx > ,
843
- ) -> ControlFlow < Self :: BreakTy > {
840
+ fn visit_const ( & mut self , ct : ty:: Const < ' tcx > ) -> ControlFlow < Self :: BreakTy > {
844
841
// Constants can only influence object safety if they reference `Self`.
845
842
// This is only possible for unevaluated constants, so we walk these here.
846
843
//
847
- // If `AbstractConst::new ` returned an error we already failed compilation
844
+ // If `AbstractConst::from_const ` returned an error we already failed compilation
848
845
// so we don't have to emit an additional error here.
849
- //
850
- // We currently recurse into abstract consts here but do not recurse in
851
- // `is_const_evaluatable`. This means that the object safety check is more
852
- // liberal than the const eval check.
853
- //
854
- // This shouldn't really matter though as we can't really use any
855
- // constants which are not considered const evaluatable.
856
846
use rustc_middle:: ty:: abstract_const:: Node ;
857
- if let Ok ( Some ( ct) ) = AbstractConst :: new ( self . tcx , uv ) {
847
+ if let Ok ( Some ( ct) ) = AbstractConst :: from_const ( self . tcx , ct ) {
858
848
walk_abstract_const ( self . tcx , ct, |node| match node. root ( self . tcx ) {
859
849
Node :: Leaf ( leaf) => self . visit_const ( leaf) ,
860
850
Node :: Cast ( _, _, ty) => self . visit_ty ( ty) ,
@@ -863,7 +853,7 @@ fn contains_illegal_self_type_reference<'tcx, T: TypeVisitable<'tcx>>(
863
853
}
864
854
} )
865
855
} else {
866
- ControlFlow :: CONTINUE
856
+ ct . super_visit_with ( self )
867
857
}
868
858
}
869
859
}
0 commit comments