diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2023-04-27 16:21:20 +1000 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2023-04-27 16:21:20 +1000 |
| commit | 4b85aa99ad487a5e64eaaee830077d866e8a9e0d (patch) | |
| tree | 9f183df4bca6613253ba012aa98cc0d004ad7aba | |
| parent | a82ad2fed4b97daf757c34407bf2cde19a40cce3 (diff) | |
| download | rust-4b85aa99ad487a5e64eaaee830077d866e8a9e0d.tar.gz rust-4b85aa99ad487a5e64eaaee830077d866e8a9e0d.zip | |
Add a comment about `TypeFoldable` and slices.
| -rw-r--r-- | compiler/rustc_type_ir/src/structural_impls.rs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/compiler/rustc_type_ir/src/structural_impls.rs b/compiler/rustc_type_ir/src/structural_impls.rs index c513bde6ecf..c9675f93f95 100644 --- a/compiler/rustc_type_ir/src/structural_impls.rs +++ b/compiler/rustc_type_ir/src/structural_impls.rs @@ -141,6 +141,10 @@ impl<I: Interner, T: TypeVisitable<I>> TypeVisitable<I> for Vec<T> { } } +// `TypeFoldable` isn't impl'd for `&[T]`. It doesn't make sense in the general +// case, because we can't return a new slice. But note that there are a couple +// of trivial impls of `TypeFoldable` for specific slice types elsewhere. + impl<I: Interner, T: TypeVisitable<I>> TypeVisitable<I> for &[T] { fn visit_with<V: TypeVisitor<I>>(&self, visitor: &mut V) -> ControlFlow<V::BreakTy> { self.iter().try_for_each(|t| t.visit_with(visitor)) |
