@@ -17,7 +17,7 @@ pub use self::subst::Subst;
1717/// certain changes applied. The idea is that it contains methods that
1818/// let you swap types/lifetimes for new types/lifetimes; meanwhile,
1919/// each bit of IR implements the `TypeFoldable` trait which, given a
20- /// `Folder `, will reconstruct itself, invoking the folder's methods
20+ /// `TypeFolder `, will reconstruct itself, invoking the folder's methods
2121/// to transform each of the types/lifetimes embedded within.
2222///
2323/// # Usage patterns
@@ -29,14 +29,14 @@ pub use self::subst::Subst;
2929/// more often, just free existential variables) that appear within
3030/// the term.
3131///
32- /// For this reason, the `Folder ` trait extends two other traits that
32+ /// For this reason, the `TypeFolder ` trait extends two other traits that
3333/// contain methods that are invoked when just those particular
3434///
3535/// In particular, folders can intercept references to free variables
3636/// (either existentially or universally quantified) and replace them
3737/// with other types/lifetimes as appropriate.
3838///
39- /// To create a folder `F`, one never implements `Folder ` directly, but instead
39+ /// To create a folder `F`, one never implements `TypeFolder ` directly, but instead
4040/// implements one of each of these three sub-traits:
4141///
4242/// - `FreeVarFolder` -- folds `BoundVar` instances that appear free
@@ -54,19 +54,19 @@ pub use self::subst::Subst;
5454/// ```rust,ignore
5555/// let x = x.fold_with(&mut folder, 0);
5656/// ```
57- pub trait Folder < I : Interner > {
57+ pub trait TypeFolder < I : Interner > {
5858 /// The type this folder returns when folding fails. This is
5959 /// commonly [`NoSolution`].
6060 type Error ;
6161
6262 /// Creates a `dyn` value from this folder. Unfortunately, this
63- /// must be added manually to each impl of Folder ; it permits the
64- /// default implements below to create a `&mut dyn Folder ` from
63+ /// must be added manually to each impl of TypeFolder ; it permits the
64+ /// default implements below to create a `&mut dyn TypeFolder ` from
6565 /// `Self` without knowing what `Self` is (by invoking this
66- /// method). Effectively, this limits impls of `Folder ` to types
66+ /// method). Effectively, this limits impls of `TypeFolder ` to types
6767 /// for which we are able to create a dyn value (i.e., not `[T]`
6868 /// types).
69- fn as_dyn ( & mut self ) -> & mut dyn Folder < I , Error = Self :: Error > ;
69+ fn as_dyn ( & mut self ) -> & mut dyn TypeFolder < I , Error = Self :: Error > ;
7070
7171 /// Top-level callback: invoked for each `Ty<I>` that is
7272 /// encountered when folding. By default, invokes
@@ -305,7 +305,7 @@ pub trait Folder<I: Interner> {
305305 fn interner ( & self ) -> I ;
306306}
307307
308- /// Applies the given `Folder ` to a value, producing a folded result
308+ /// Applies the given `TypeFolder ` to a value, producing a folded result
309309/// of type `Self::Result`. The result type is typically the same as
310310/// the source type, but in some cases we convert from borrowed
311311/// to owned as well (e.g., the folder for `&T` will fold to a fresh
@@ -325,19 +325,19 @@ pub trait TypeFoldable<I: Interner>: Debug {
325325 /// constructs.
326326 fn fold_with < E > (
327327 self ,
328- folder : & mut dyn Folder < I , Error = E > ,
328+ folder : & mut dyn TypeFolder < I , Error = E > ,
329329 outer_binder : DebruijnIndex ,
330330 ) -> Result < Self :: Result , E > ;
331331}
332332
333- /// For types where "fold" invokes a callback on the `Folder `, the
333+ /// For types where "fold" invokes a callback on the `TypeFolder `, the
334334/// `TypeSuperFoldable` trait captures the recursive behavior that folds all
335335/// the contents of the type.
336336pub trait TypeSuperFoldable < I : Interner > : TypeFoldable < I > {
337337 /// Recursively folds the value.
338338 fn super_fold_with < E > (
339339 self ,
340- folder : & mut dyn Folder < I , Error = E > ,
340+ folder : & mut dyn TypeFolder < I , Error = E > ,
341341 outer_binder : DebruijnIndex ,
342342 ) -> Result < Self :: Result , E > ;
343343}
@@ -350,7 +350,7 @@ impl<I: Interner> TypeFoldable<I> for Ty<I> {
350350
351351 fn fold_with < E > (
352352 self ,
353- folder : & mut dyn Folder < I , Error = E > ,
353+ folder : & mut dyn TypeFolder < I , Error = E > ,
354354 outer_binder : DebruijnIndex ,
355355 ) -> Result < Self :: Result , E > {
356356 folder. fold_ty ( self , outer_binder)
@@ -364,7 +364,7 @@ where
364364{
365365 fn super_fold_with < E > (
366366 self ,
367- folder : & mut dyn Folder < I , Error = E > ,
367+ folder : & mut dyn TypeFolder < I , Error = E > ,
368368 outer_binder : DebruijnIndex ,
369369 ) -> Result < Ty < I > , E > {
370370 let interner = folder. interner ( ) ;
@@ -474,7 +474,7 @@ impl<I: Interner> TypeFoldable<I> for Lifetime<I> {
474474
475475 fn fold_with < E > (
476476 self ,
477- folder : & mut dyn Folder < I , Error = E > ,
477+ folder : & mut dyn TypeFolder < I , Error = E > ,
478478 outer_binder : DebruijnIndex ,
479479 ) -> Result < Self :: Result , E > {
480480 folder. fold_lifetime ( self , outer_binder)
@@ -487,7 +487,7 @@ where
487487{
488488 fn super_fold_with < E > (
489489 self ,
490- folder : & mut dyn Folder < I , Error = E > ,
490+ folder : & mut dyn TypeFolder < I , Error = E > ,
491491 outer_binder : DebruijnIndex ,
492492 ) -> Result < Lifetime < I > , E > {
493493 let interner = folder. interner ( ) ;
@@ -526,7 +526,7 @@ impl<I: Interner> TypeFoldable<I> for Const<I> {
526526
527527 fn fold_with < E > (
528528 self ,
529- folder : & mut dyn Folder < I , Error = E > ,
529+ folder : & mut dyn TypeFolder < I , Error = E > ,
530530 outer_binder : DebruijnIndex ,
531531 ) -> Result < Self :: Result , E > {
532532 folder. fold_const ( self , outer_binder)
@@ -539,7 +539,7 @@ where
539539{
540540 fn super_fold_with < E > (
541541 self ,
542- folder : & mut dyn Folder < I , Error = E > ,
542+ folder : & mut dyn TypeFolder < I , Error = E > ,
543543 outer_binder : DebruijnIndex ,
544544 ) -> Result < Const < I > , E > {
545545 let interner = folder. interner ( ) ;
@@ -577,7 +577,7 @@ impl<I: Interner> TypeFoldable<I> for Goal<I> {
577577
578578 fn fold_with < E > (
579579 self ,
580- folder : & mut dyn Folder < I , Error = E > ,
580+ folder : & mut dyn TypeFolder < I , Error = E > ,
581581 outer_binder : DebruijnIndex ,
582582 ) -> Result < Self :: Result , E > {
583583 folder. fold_goal ( self , outer_binder)
@@ -588,7 +588,7 @@ impl<I: Interner> TypeFoldable<I> for Goal<I> {
588588impl < I : Interner > TypeSuperFoldable < I > for Goal < I > {
589589 fn super_fold_with < E > (
590590 self ,
591- folder : & mut dyn Folder < I , Error = E > ,
591+ folder : & mut dyn TypeFolder < I , Error = E > ,
592592 outer_binder : DebruijnIndex ,
593593 ) -> Result < Self :: Result , E > {
594594 let interner = folder. interner ( ) ;
@@ -609,7 +609,7 @@ impl<I: Interner> TypeFoldable<I> for ProgramClause<I> {
609609
610610 fn fold_with < E > (
611611 self ,
612- folder : & mut dyn Folder < I , Error = E > ,
612+ folder : & mut dyn TypeFolder < I , Error = E > ,
613613 outer_binder : DebruijnIndex ,
614614 ) -> Result < Self :: Result , E > {
615615 folder. fold_program_clause ( self , outer_binder)
0 commit comments