Skip to content

Commit 4fad40b

Browse files
authored
Unrolled build for #158698
Rollup merge of #158698 - addiesh:oh-a-visitor, r=oli-obk Update TypeVisitable implementation r? oli-obk `TypeVisitable` had some redundant/specific implementations which I've generalized and extended to be a little more broad. Boxed slices now derive their impl from `Box<T>` and `[T]` (instead of `Box<[T]>`), and an implementation for fixed-size arrays was added cuz [I needed that](https://github.com/rust-lang/rust/pull/158632/changes#diff-f1c6da80803e15c8bca78842a05972878a299c2b375dab82635e1124cd0ce08fR539). Also removed `Sized` restrictions on `&T` and `Box<T>` to make it all work. Could probably stand to do the same for some other types, but that wasn't necessary for my changes.
2 parents 1c02d90 + cc7cef5 commit 4fad40b

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

compiler/rustc_type_ir/src/visit.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ impl<I: Interner, T: TypeVisitable<I>, E: TypeVisitable<I>> TypeVisitable<I> for
167167
}
168168
}
169169

170-
impl<I: Interner, T: TypeVisitable<I>> TypeVisitable<I> for &T {
170+
impl<I: Interner, T: TypeVisitable<I> + ?Sized> TypeVisitable<I> for &T {
171171
fn visit_with<V: TypeVisitor<I>>(&self, visitor: &mut V) -> V::Result {
172172
(**self).visit_with(visitor)
173173
}
@@ -179,7 +179,7 @@ impl<I: Interner, T: TypeVisitable<I>> TypeVisitable<I> for Arc<T> {
179179
}
180180
}
181181

182-
impl<I: Interner, T: TypeVisitable<I>> TypeVisitable<I> for Box<T> {
182+
impl<I: Interner, T: TypeVisitable<I> + ?Sized> TypeVisitable<I> for Box<T> {
183183
fn visit_with<V: TypeVisitor<I>>(&self, visitor: &mut V) -> V::Result {
184184
(**self).visit_with(visitor)
185185
}
@@ -209,14 +209,14 @@ impl<I: Interner, T: TypeVisitable<I>, const N: usize> TypeVisitable<I> for Smal
209209
// `TypeFoldable` isn't impl'd for `&[T]`. It doesn't make sense in the general
210210
// case, because we can't return a new slice. But note that there are a couple
211211
// of trivial impls of `TypeFoldable` for specific slice types elsewhere.
212-
impl<I: Interner, T: TypeVisitable<I>> TypeVisitable<I> for &[T] {
212+
impl<I: Interner, T: TypeVisitable<I>> TypeVisitable<I> for [T] {
213213
fn visit_with<V: TypeVisitor<I>>(&self, visitor: &mut V) -> V::Result {
214214
walk_visitable_list!(visitor, self.iter());
215215
V::Result::output()
216216
}
217217
}
218218

219-
impl<I: Interner, T: TypeVisitable<I>> TypeVisitable<I> for Box<[T]> {
219+
impl<const N: usize, I: Interner, T: TypeVisitable<I>> TypeVisitable<I> for [T; N] {
220220
fn visit_with<V: TypeVisitor<I>>(&self, visitor: &mut V) -> V::Result {
221221
walk_visitable_list!(visitor, self.iter());
222222
V::Result::output()

0 commit comments

Comments
 (0)