1414//! instance of a "folder" (a type which implements `TypeFolder`). Then
1515//! the setup is intended to be:
1616//!
17- //! T.fold_with(F) --calls--> F.fold_T(T) --calls--> T.fold_subitems_with (F)
17+ //! T.fold_with(F) --calls--> F.fold_T(T) --calls--> T.super_fold_with (F)
1818//!
1919//! This way, when you define a new folder F, you can override
20- //! `fold_T()` to customize the behavior, and invoke `T.fold_subitems_with ()`
20+ //! `fold_T()` to customize the behavior, and invoke `T.super_fold_with ()`
2121//! to get the original behavior. Meanwhile, to actually fold
2222//! something, you can just write `T.fold_with(F)`, which is
2323//! convenient. (Note that `fold_with` will also transparently handle
2424//! things like a `Vec<T>` where T is foldable and so on.)
2525//!
2626//! In this ideal setup, the only function that actually *does*
27- //! anything is `T.fold_subitems_with ()`, which traverses the type `T`.
28- //! Moreover, `T.fold_subitems_with ()` should only ever call `T.fold_with()`.
27+ //! anything is `T.super_fold_with ()`, which traverses the type `T`.
28+ //! Moreover, `T.super_fold_with ()` should only ever call `T.fold_with()`.
2929//!
3030//! In some cases, we follow a degenerate pattern where we do not have
3131//! a `fold_T` method. Instead, `T.fold_with` traverses the structure directly.
3535//! proper thing.
3636//!
3737//! A `TypeFoldable` T can also be visited by a `TypeVisitor` V using similar setup:
38- //! T.visit_with(V) --calls--> V.visit_T(T) --calls--> T.visit_subitems_with (V).
38+ //! T.visit_with(V) --calls--> V.visit_T(T) --calls--> T.super_visit_with (V).
3939//! These methods return true to indicate that the visitor has found what it is looking for
4040//! and does not need to visit anything else.
4141
@@ -50,14 +50,14 @@ use util::nodemap::{FnvHashMap, FnvHashSet};
5050/// The TypeFoldable trait is implemented for every type that can be folded.
5151/// Basically, every type that has a corresponding method in TypeFolder.
5252pub trait TypeFoldable < ' tcx > : fmt:: Debug + Clone {
53- fn fold_with < F : TypeFolder < ' tcx > > ( & self , folder : & mut F ) -> Self ;
54- fn fold_subitems_with < F : TypeFolder < ' tcx > > ( & self , folder : & mut F ) -> Self {
55- self . fold_with ( folder)
53+ fn super_fold_with < F : TypeFolder < ' tcx > > ( & self , folder : & mut F ) -> Self ;
54+ fn fold_with < F : TypeFolder < ' tcx > > ( & self , folder : & mut F ) -> Self {
55+ self . super_fold_with ( folder)
5656 }
5757
58- fn visit_with < V : TypeVisitor < ' tcx > > ( & self , visitor : & mut V ) -> bool ;
59- fn visit_subitems_with < V : TypeVisitor < ' tcx > > ( & self , visitor : & mut V ) -> bool {
60- self . visit_with ( visitor)
58+ fn super_visit_with < V : TypeVisitor < ' tcx > > ( & self , visitor : & mut V ) -> bool ;
59+ fn visit_with < V : TypeVisitor < ' tcx > > ( & self , visitor : & mut V ) -> bool {
60+ self . super_visit_with ( visitor)
6161 }
6262
6363 fn has_regions_escaping_depth ( & self , depth : u32 ) -> bool {
@@ -131,64 +131,64 @@ pub trait TypeFolder<'tcx> : Sized {
131131 where T : TypeFoldable < ' tcx >
132132 {
133133 // FIXME(#20526) this should replace `enter_region_binder`/`exit_region_binder`.
134- t. fold_subitems_with ( self )
134+ t. super_fold_with ( self )
135135 }
136136
137137 fn fold_ty ( & mut self , t : Ty < ' tcx > ) -> Ty < ' tcx > {
138- t. fold_subitems_with ( self )
138+ t. super_fold_with ( self )
139139 }
140140
141141 fn fold_mt ( & mut self , t : & ty:: TypeAndMut < ' tcx > ) -> ty:: TypeAndMut < ' tcx > {
142- t. fold_subitems_with ( self )
142+ t. super_fold_with ( self )
143143 }
144144
145145 fn fold_trait_ref ( & mut self , t : & ty:: TraitRef < ' tcx > ) -> ty:: TraitRef < ' tcx > {
146- t. fold_subitems_with ( self )
146+ t. super_fold_with ( self )
147147 }
148148
149149 fn fold_substs ( & mut self ,
150150 substs : & subst:: Substs < ' tcx > )
151151 -> subst:: Substs < ' tcx > {
152- substs. fold_subitems_with ( self )
152+ substs. super_fold_with ( self )
153153 }
154154
155155 fn fold_fn_sig ( & mut self ,
156156 sig : & ty:: FnSig < ' tcx > )
157157 -> ty:: FnSig < ' tcx > {
158- sig. fold_subitems_with ( self )
158+ sig. super_fold_with ( self )
159159 }
160160
161161 fn fold_output ( & mut self ,
162162 output : & ty:: FnOutput < ' tcx > )
163163 -> ty:: FnOutput < ' tcx > {
164- output. fold_subitems_with ( self )
164+ output. super_fold_with ( self )
165165 }
166166
167167 fn fold_bare_fn_ty ( & mut self ,
168168 fty : & ty:: BareFnTy < ' tcx > )
169169 -> ty:: BareFnTy < ' tcx >
170170 {
171- fty. fold_subitems_with ( self )
171+ fty. super_fold_with ( self )
172172 }
173173
174174 fn fold_closure_ty ( & mut self ,
175175 fty : & ty:: ClosureTy < ' tcx > )
176176 -> ty:: ClosureTy < ' tcx > {
177- fty. fold_subitems_with ( self )
177+ fty. super_fold_with ( self )
178178 }
179179
180180 fn fold_region ( & mut self , r : ty:: Region ) -> ty:: Region {
181- r. fold_subitems_with ( self )
181+ r. super_fold_with ( self )
182182 }
183183
184184 fn fold_existential_bounds ( & mut self , s : & ty:: ExistentialBounds < ' tcx > )
185185 -> ty:: ExistentialBounds < ' tcx > {
186- s. fold_subitems_with ( self )
186+ s. super_fold_with ( self )
187187 }
188188
189189 fn fold_autoref ( & mut self , ar : & adjustment:: AutoRef < ' tcx > )
190190 -> adjustment:: AutoRef < ' tcx > {
191- ar. fold_subitems_with ( self )
191+ ar. super_fold_with ( self )
192192 }
193193}
194194
@@ -197,11 +197,11 @@ pub trait TypeVisitor<'tcx> : Sized {
197197 fn exit_region_binder ( & mut self ) { }
198198
199199 fn visit_ty ( & mut self , t : Ty < ' tcx > ) -> bool {
200- t. visit_subitems_with ( self )
200+ t. super_visit_with ( self )
201201 }
202202
203203 fn visit_region ( & mut self , r : ty:: Region ) -> bool {
204- r. visit_subitems_with ( self )
204+ r. super_visit_with ( self )
205205 }
206206}
207207
@@ -219,7 +219,7 @@ impl<'a, 'tcx, F> TypeFolder<'tcx> for BottomUpFolder<'a, 'tcx, F> where
219219 fn tcx ( & self ) -> & ty:: ctxt < ' tcx > { self . tcx }
220220
221221 fn fold_ty ( & mut self , ty : Ty < ' tcx > ) -> Ty < ' tcx > {
222- let t1 = ty. fold_subitems_with ( self ) ;
222+ let t1 = ty. super_fold_with ( self ) ;
223223 ( self . fldop ) ( t1)
224224 }
225225}
@@ -447,7 +447,7 @@ impl<'a, 'tcx> TypeFolder<'tcx> for RegionReplacer<'a, 'tcx>
447447 return t;
448448 }
449449
450- t. fold_subitems_with ( self )
450+ t. super_fold_with ( self )
451451 }
452452
453453 fn fold_region ( & mut self , r : ty:: Region ) -> ty:: Region {
@@ -498,7 +498,7 @@ impl<'tcx> ty::ctxt<'tcx> {
498498 Some ( u) => return u
499499 }
500500
501- let t_norm = ty. fold_subitems_with ( self ) ;
501+ let t_norm = ty. super_fold_with ( self ) ;
502502 self . tcx ( ) . normalized_cache . borrow_mut ( ) . insert ( ty, t_norm) ;
503503 return t_norm;
504504 }
@@ -507,7 +507,7 @@ impl<'tcx> ty::ctxt<'tcx> {
507507 where T : TypeFoldable < ' tcx >
508508 {
509509 let u = self . tcx ( ) . anonymize_late_bound_regions ( t) ;
510- u. fold_subitems_with ( self )
510+ u. super_fold_with ( self )
511511 }
512512
513513 fn fold_region ( & mut self , r : ty:: Region ) -> ty:: Region {
0 commit comments