We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
TypeFoldable
TypeVisitable
1 parent 593373f commit df98a74Copy full SHA for df98a74
compiler/rustc_type_ir/src/fold.rs
@@ -51,6 +51,12 @@ use crate::{visit::TypeVisitable, Interner};
51
///
52
/// To implement this conveniently, use the derive macro located in
53
/// `rustc_macros`.
54
+///
55
+/// This trait is a sub-trait of `TypeVisitable`. This is because many
56
+/// `TypeFolder` instances use the methods in `TypeVisitableExt` while folding,
57
+/// which means in practice almost every foldable type needs to also be
58
+/// visitable. (However, there are some types that are visitable without being
59
+/// foldable.)
60
pub trait TypeFoldable<I: Interner>: TypeVisitable<I> {
61
/// The entry point for folding. To fold a value `t` with a folder `f`
62
/// call: `t.try_fold_with(f)`.
0 commit comments