Remove TypeWalk and use TypeFlags instead

This commit is contained in:
Ryo Yoshida 2023-01-24 19:26:07 +09:00
parent c552e5a55f
commit e9f14c505f
No known key found for this signature in database
GPG key ID: E25698A930586171
4 changed files with 8 additions and 159 deletions

View file

@ -3168,6 +3168,8 @@ impl Type {
}
pub fn contains_unknown(&self) -> bool {
// FIXME: When we get rid of `ConstScalar::Unknown`, we can just look at precomputed
// `TypeFlags` in `TyData`.
return go(&self.ty);
fn go(ty: &Ty) -> bool {
@ -3482,10 +3484,9 @@ impl Type {
Type { env: self.env.clone(), ty }
}
/// Visits every type, including generic arguments, in this type. `cb` is called with type
/// itself first, and then with its generic arguments.
pub fn walk(&self, db: &dyn HirDatabase, mut cb: impl FnMut(Type)) {
// TypeWalk::walk for a Ty at first visits parameters and only after that the Ty itself.
// We need a different order here.
fn walk_substs(
db: &dyn HirDatabase,
type_: &Type,