Remove walk_shallow

This commit is contained in:
Michael Goulet 2024-07-05 16:13:20 -04:00
parent cc6c5de39d
commit c2a88ea6ca

View File

@ -78,23 +78,6 @@ impl<'tcx> GenericArg<'tcx> {
pub fn walk(self) -> TypeWalker<'tcx> {
TypeWalker::new(self)
}
/// Iterator that walks the immediate children of `self`. Hence
/// `Foo<Bar<i32>, u32>` yields the sequence `[Bar<i32>, u32]`
/// (but not `i32`, like `walk`).
///
/// Iterator only walks items once.
/// It accepts visited set, updates it with all visited types
/// and skips any types that are already there.
pub fn walk_shallow(
self,
visited: &mut SsoHashSet<GenericArg<'tcx>>,
) -> impl Iterator<Item = GenericArg<'tcx>> {
let mut stack = SmallVec::new();
push_inner(&mut stack, self);
stack.retain(|a| visited.insert(*a));
stack.into_iter()
}
}
impl<'tcx> Ty<'tcx> {