Skip to content

Commit 4b85aa9

Browse files
committed
Add a comment about TypeFoldable and slices.
1 parent a82ad2f commit 4b85aa9

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

compiler/rustc_type_ir/src/structural_impls.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,10 @@ impl<I: Interner, T: TypeVisitable<I>> TypeVisitable<I> for Vec<T> {
141141
}
142142
}
143143

144+
// `TypeFoldable` isn't impl'd for `&[T]`. It doesn't make sense in the general
145+
// case, because we can't return a new slice. But note that there are a couple
146+
// of trivial impls of `TypeFoldable` for specific slice types elsewhere.
147+
144148
impl<I: Interner, T: TypeVisitable<I>> TypeVisitable<I> for &[T] {
145149
fn visit_with<V: TypeVisitor<I>>(&self, visitor: &mut V) -> ControlFlow<V::BreakTy> {
146150
self.iter().try_for_each(|t| t.visit_with(visitor))

0 commit comments

Comments
 (0)