[ty] Use upstream GetSize implementation for OrderMap and OrderSet (#22374)
This commit is contained in:
@@ -14364,7 +14364,7 @@ impl KnownUnion {
|
||||
}
|
||||
}
|
||||
|
||||
#[salsa::interned(debug, heap_size=IntersectionType::heap_size)]
|
||||
#[salsa::interned(debug, heap_size=ruff_memory_usage::heap_size)]
|
||||
pub struct IntersectionType<'db> {
|
||||
/// The intersection type includes only values in all of these types.
|
||||
#[returns(ref)]
|
||||
@@ -14653,11 +14653,6 @@ impl<'db> IntersectionType<'db> {
|
||||
pub(crate) fn is_simple_negation(self, db: &'db dyn Db) -> bool {
|
||||
self.positive(db).is_empty() && self.negative(db).len() == 1
|
||||
}
|
||||
|
||||
fn heap_size((positive, negative): &(FxOrderSet<Type<'db>>, FxOrderSet<Type<'db>>)) -> usize {
|
||||
ruff_memory_usage::order_set_heap_size(positive)
|
||||
+ ruff_memory_usage::order_set_heap_size(negative)
|
||||
}
|
||||
}
|
||||
|
||||
/// # Ordering
|
||||
|
||||
@@ -202,7 +202,7 @@ impl<'a, 'db> InferableTypeVars<'a, 'db> {
|
||||
/// # Ordering
|
||||
/// Ordering is based on the context's salsa-assigned id and not on its values.
|
||||
/// The id may change between runs, or when the context was garbage collected and recreated.
|
||||
#[salsa::interned(debug, constructor=new_internal, heap_size=GenericContext::heap_size)]
|
||||
#[salsa::interned(debug, constructor=new_internal, heap_size=ruff_memory_usage::heap_size)]
|
||||
#[derive(PartialOrd, Ord)]
|
||||
pub struct GenericContext<'db> {
|
||||
#[returns(ref)]
|
||||
@@ -689,12 +689,6 @@ impl<'db> GenericContext<'db> {
|
||||
|
||||
Self::from_typevar_instances(db, variables)
|
||||
}
|
||||
|
||||
fn heap_size(
|
||||
(variables,): &(FxOrderMap<BoundTypeVarIdentity<'db>, BoundTypeVarInstance<'db>>,),
|
||||
) -> usize {
|
||||
ruff_memory_usage::order_map_heap_size(variables)
|
||||
}
|
||||
}
|
||||
|
||||
fn inferable_typevars_cycle_initial<'db>(
|
||||
|
||||
Reference in New Issue
Block a user