Skip to content

Commit 9a7feef

Browse files
committed
Rename SuperFold to TypeSuperFoldable
1 parent a4c9420 commit 9a7feef

File tree

5 files changed

+16
-16
lines changed

5 files changed

+16
-16
lines changed

book/src/types/operations/fold.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ folder can substitute a new type in its place.
2929
A common use for `TypeFoldable` is to permit a substitution -- that is,
3030
replacing generic type parameters with their values.
3131

32-
## From TypeFoldable to Folder to SuperFold and back again
32+
## From TypeFoldable to Folder to TypeSuperFoldable and back again
3333

3434
The overall flow of folding is like this.
3535

@@ -39,7 +39,7 @@ The overall flow of folding is like this.
3939
callbacks in the [`Folder`] trait, invoking [`TypeFoldable::fold_with`] will in turn
4040
invoke the corresponding method on the [`Folder`] trait, such as `Folder::fold_ty`.
4141
3. The default implementation of `Folder::fold_ty`, in turn, invokes
42-
`SuperFold::super_fold_with`. This will recursively fold the
42+
`TypeSuperFoldable::super_fold_with`. This will recursively fold the
4343
contents of the type. In some cases, the `super_fold_with`
4444
implementation invokes more specialized methods on [`Folder`], such
4545
as [`Folder::fold_free_var_ty`], which makes it easier to write
@@ -53,7 +53,7 @@ Thus, as a user, you can customize folding by:
5353
* Implementing the appropriate methods to "intercept" types/lifetimes/etc at the right level of
5454
detail
5555
* In those methods, if you find a case where you would prefer not to
56-
substitute a new value, then invoke `SuperFold::super_fold_with` to
56+
substitute a new value, then invoke `TypeSuperFoldable::super_fold_with` to
5757
return to the default behavior.
5858

5959
## The `binders` argument
@@ -77,21 +77,21 @@ type that will result from folding.
7777

7878
[`Result`]: https://rust-lang.github.io/chalk/chalk_ir/fold/trait.TypeFoldable.html#associatedtype.Result
7979

80-
## When to implement the TypeFoldable and SuperFold traits
80+
## When to implement the TypeFoldable and TypeSuperFoldable traits
8181

8282
Any piece of IR that represents a kind of "term" (e.g., a type, part
8383
of a type, or a goal, etc) in the logic should implement `TypeFoldable`. We
8484
also implement `TypeFoldable` for common collection types like `Vec` as well
8585
as tuples, references, etc.
8686

87-
The `SuperFold` trait should only be implemented for those types that
87+
The `TypeSuperFoldable` trait should only be implemented for those types that
8888
have a callback defined on the `Folder` trait (e.g., types and
8989
lifetimes).
9090

9191
## Derives
9292

9393
Using the `chalk-derive` crate, you can auto-derive the `TypeFoldable` trait.
94-
There isn't presently a derive for `SuperFold` since it is very rare
94+
There isn't presently a derive for `TypeSuperFoldable` since it is very rare
9595
to require it. The derive for `TypeFoldable` is a bit cludgy and requires:
9696

9797
* You must import `TypeFoldable` into scope.

chalk-ir/src/fold.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -331,9 +331,9 @@ pub trait TypeFoldable<I: Interner>: Debug {
331331
}
332332

333333
/// For types where "fold" invokes a callback on the `Folder`, the
334-
/// `SuperFold` trait captures the recursive behavior that folds all
334+
/// `TypeSuperFoldable` trait captures the recursive behavior that folds all
335335
/// the contents of the type.
336-
pub trait SuperFold<I: Interner>: TypeFoldable<I> {
336+
pub trait TypeSuperFoldable<I: Interner>: TypeFoldable<I> {
337337
/// Recursively folds the value.
338338
fn super_fold_with<E>(
339339
self,
@@ -358,7 +358,7 @@ impl<I: Interner> TypeFoldable<I> for Ty<I> {
358358
}
359359

360360
/// "Super fold" for a type invokes te more detailed callbacks on the type
361-
impl<I> SuperFold<I> for Ty<I>
361+
impl<I> TypeSuperFoldable<I> for Ty<I>
362362
where
363363
I: Interner,
364364
{
@@ -481,7 +481,7 @@ impl<I: Interner> TypeFoldable<I> for Lifetime<I> {
481481
}
482482
}
483483

484-
impl<I> SuperFold<I> for Lifetime<I>
484+
impl<I> TypeSuperFoldable<I> for Lifetime<I>
485485
where
486486
I: Interner,
487487
{
@@ -533,7 +533,7 @@ impl<I: Interner> TypeFoldable<I> for Const<I> {
533533
}
534534
}
535535

536-
impl<I> SuperFold<I> for Const<I>
536+
impl<I> TypeSuperFoldable<I> for Const<I>
537537
where
538538
I: Interner,
539539
{
@@ -585,7 +585,7 @@ impl<I: Interner> TypeFoldable<I> for Goal<I> {
585585
}
586586

587587
/// Superfold folds recursively.
588-
impl<I: Interner> SuperFold<I> for Goal<I> {
588+
impl<I: Interner> TypeSuperFoldable<I> for Goal<I> {
589589
fn super_fold_with<E>(
590590
self,
591591
folder: &mut dyn Folder<I, Error = E>,

chalk-ir/src/fold/boring_impls.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ id_fold!(ClosureId);
220220
id_fold!(GeneratorId);
221221
id_fold!(ForeignDefId);
222222

223-
impl<I: Interner> SuperFold<I> for ProgramClauseData<I> {
223+
impl<I: Interner> TypeSuperFoldable<I> for ProgramClauseData<I> {
224224
fn super_fold_with<E>(
225225
self,
226226
folder: &mut dyn Folder<I, Error = E>,
@@ -230,7 +230,7 @@ impl<I: Interner> SuperFold<I> for ProgramClauseData<I> {
230230
}
231231
}
232232

233-
impl<I: Interner> SuperFold<I> for ProgramClause<I> {
233+
impl<I: Interner> TypeSuperFoldable<I> for ProgramClause<I> {
234234
fn super_fold_with<E>(
235235
self,
236236
folder: &mut dyn Folder<I, Error = E>,

chalk-ir/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ extern crate self as chalk_ir;
88

99
use crate::cast::{Cast, CastTo, Caster};
1010
use crate::fold::shift::Shift;
11-
use crate::fold::{Folder, Subst, SuperFold, TypeFoldable};
11+
use crate::fold::{Folder, Subst, TypeFoldable, TypeSuperFoldable};
1212
use crate::visit::{SuperVisit, Visit, VisitExt, Visitor};
1313
use chalk_derive::{HasInterner, SuperVisit, TypeFoldable, Visit, Zip};
1414
use std::marker::PhantomData;

chalk-solve/src/infer/canonicalize.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::debug_span;
22
use chalk_ir::fold::shift::Shift;
3-
use chalk_ir::fold::{Folder, SuperFold, TypeFoldable};
3+
use chalk_ir::fold::{Folder, TypeFoldable, TypeSuperFoldable};
44
use chalk_ir::interner::{HasInterner, Interner};
55
use chalk_ir::*;
66
use std::cmp::max;

0 commit comments

Comments
 (0)