@@ -310,14 +310,7 @@ pub trait TypeFolder<I: Interner> {
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
312312/// `T`; well, actually `T::Result`).
313- pub trait TypeFoldable < I : Interner > : Debug {
314- /// The type of value that will be produced once folding is done.
315- /// Typically this is `Self`, unless `Self` contains borrowed
316- /// values, in which case owned values are produced (for example,
317- /// one can fold over a `&T` value where `T: TypeFoldable`, in which case
318- /// you get back a `T`, not a `&T`).
319- type Result ;
320-
313+ pub trait TypeFoldable < I : Interner > : Debug + Sized {
321314 /// Apply the given folder `folder` to `self`; `binders` is the
322315 /// number of binders that are in scope when beginning the
323316 /// folder. Typically `binders` starts as 0, but is adjusted when
@@ -327,7 +320,7 @@ pub trait TypeFoldable<I: Interner>: Debug {
327320 self ,
328321 folder : & mut dyn TypeFolder < I , Error = E > ,
329322 outer_binder : DebruijnIndex ,
330- ) -> Result < Self :: Result , E > ;
323+ ) -> Result < Self , E > ;
331324}
332325
333326/// For types where "fold" invokes a callback on the `TypeFolder`, the
@@ -339,20 +332,18 @@ pub trait TypeSuperFoldable<I: Interner>: TypeFoldable<I> {
339332 self ,
340333 folder : & mut dyn TypeFolder < I , Error = E > ,
341334 outer_binder : DebruijnIndex ,
342- ) -> Result < Self :: Result , E > ;
335+ ) -> Result < Self , E > ;
343336}
344337
345338/// "Folding" a type invokes the `fold_ty` method on the folder; this
346339/// usually (in turn) invokes `super_fold_ty` to fold the individual
347340/// parts.
348341impl < I : Interner > TypeFoldable < I > for Ty < I > {
349- type Result = Ty < I > ;
350-
351342 fn fold_with < E > (
352343 self ,
353344 folder : & mut dyn TypeFolder < I , Error = E > ,
354345 outer_binder : DebruijnIndex ,
355- ) -> Result < Self :: Result , E > {
346+ ) -> Result < Self , E > {
356347 folder. fold_ty ( self , outer_binder)
357348 }
358349}
@@ -470,13 +461,11 @@ where
470461/// usually (in turn) invokes `super_fold_lifetime` to fold the individual
471462/// parts.
472463impl < I : Interner > TypeFoldable < I > for Lifetime < I > {
473- type Result = Lifetime < I > ;
474-
475464 fn fold_with < E > (
476465 self ,
477466 folder : & mut dyn TypeFolder < I , Error = E > ,
478467 outer_binder : DebruijnIndex ,
479- ) -> Result < Self :: Result , E > {
468+ ) -> Result < Self , E > {
480469 folder. fold_lifetime ( self , outer_binder)
481470 }
482471}
@@ -522,13 +511,11 @@ where
522511/// usually (in turn) invokes `super_fold_const` to fold the individual
523512/// parts.
524513impl < I : Interner > TypeFoldable < I > for Const < I > {
525- type Result = Const < I > ;
526-
527514 fn fold_with < E > (
528515 self ,
529516 folder : & mut dyn TypeFolder < I , Error = E > ,
530517 outer_binder : DebruijnIndex ,
531- ) -> Result < Self :: Result , E > {
518+ ) -> Result < Self , E > {
532519 folder. fold_const ( self , outer_binder)
533520 }
534521}
@@ -573,13 +560,11 @@ where
573560/// Folding a goal invokes the `fold_goal` callback (which will, by
574561/// default, invoke super-fold).
575562impl < I : Interner > TypeFoldable < I > for Goal < I > {
576- type Result = Goal < I > ;
577-
578563 fn fold_with < E > (
579564 self ,
580565 folder : & mut dyn TypeFolder < I , Error = E > ,
581566 outer_binder : DebruijnIndex ,
582- ) -> Result < Self :: Result , E > {
567+ ) -> Result < Self , E > {
583568 folder. fold_goal ( self , outer_binder)
584569 }
585570}
@@ -590,7 +575,7 @@ impl<I: Interner> TypeSuperFoldable<I> for Goal<I> {
590575 self ,
591576 folder : & mut dyn TypeFolder < I , Error = E > ,
592577 outer_binder : DebruijnIndex ,
593- ) -> Result < Self :: Result , E > {
578+ ) -> Result < Self , E > {
594579 let interner = folder. interner ( ) ;
595580 Ok ( Goal :: new (
596581 interner,
@@ -605,13 +590,11 @@ impl<I: Interner> TypeSuperFoldable<I> for Goal<I> {
605590/// callback on the folder (which will, by default, invoke the
606591/// `super_fold_with` method on the program clause).
607592impl < I : Interner > TypeFoldable < I > for ProgramClause < I > {
608- type Result = ProgramClause < I > ;
609-
610593 fn fold_with < E > (
611594 self ,
612595 folder : & mut dyn TypeFolder < I , Error = E > ,
613596 outer_binder : DebruijnIndex ,
614- ) -> Result < Self :: Result , E > {
597+ ) -> Result < Self , E > {
615598 folder. fold_program_clause ( self , outer_binder)
616599 }
617600}
0 commit comments