@@ -837,24 +837,14 @@ fn contains_illegal_self_type_reference<'tcx, T: TypeVisitable<'tcx>>(
837837 }
838838 }
839839
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 > {
844841 // Constants can only influence object safety if they reference `Self`.
845842 // This is only possible for unevaluated constants, so we walk these here.
846843 //
847- // If `AbstractConst::new ` returned an error we already failed compilation
844+ // If `AbstractConst::from_const ` returned an error we already failed compilation
848845 // 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.
856846 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 ) {
858848 walk_abstract_const ( self . tcx , ct, |node| match node. root ( self . tcx ) {
859849 Node :: Leaf ( leaf) => self . visit_const ( leaf) ,
860850 Node :: Cast ( _, _, ty) => self . visit_ty ( ty) ,
@@ -863,7 +853,7 @@ fn contains_illegal_self_type_reference<'tcx, T: TypeVisitable<'tcx>>(
863853 }
864854 } )
865855 } else {
866- ControlFlow :: CONTINUE
856+ ct . super_visit_with ( self )
867857 }
868858 }
869859 }
0 commit comments