Distinguish between pending and resolved ability stores

Now that we have unspecialized lambda sets, we need to properly copy
their specialization variables when a module imports another modules'
ability store. I think it will be easier to ensure the correctness if
we distinguish between a "pending" ability store (which may contain
imports whose variables have not been added to subs yet) and "resolved"
abilities stores, which are what we care about for solve and later on.

There is a cost to this since `PendingAbilitiesStore#resolve` destroys
and collects all of the ability member data, rather than in-place
mutating as we did before. However, the resulting `AbilitiesStore` is
now much smaller, so the memory footprint will be better, and also
every field besides `ability_members` will be moved rather than copied.
This commit is contained in:
Ayaz Hafiz 2022-06-09 12:52:40 -04:00
parent a57dd820a1
commit aa9b70a7c8
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
8 changed files with 228 additions and 139 deletions

View file

@ -628,9 +628,7 @@ pub fn resolve_ability_specialization(
// Figure out the ability we're resolving in a temporary subs snapshot.
let snapshot = subs.snapshot();
let signature_var = member_def
.signature_var()
.unwrap_or_else(|| internal_error!("Signature var not resolved for {:?}", ability_member));
let signature_var = member_def.signature_var();
instantiate_rigids(subs, signature_var);
let (_vars, must_implement_ability, _lambda_sets_to_specialize) =