update instantiate rigid

This commit is contained in:
Folkert 2022-05-20 21:18:52 +02:00
parent 22ca51c881
commit f2deb37a30
No known key found for this signature in database
GPG key ID: 1F17F6FFD112B97C

View file

@ -2899,17 +2899,25 @@ fn instantiate_rigids_help(subs: &mut Subs, max_rank: Rank, initial: Variable) {
// NOTE: we must write to the mutually borrowed `desc` value here // NOTE: we must write to the mutually borrowed `desc` value here
// using `subs.set` does not work (unclear why, really) // using `subs.set` does not work (unclear why, really)
// but get_ref_mut approach saves a lookup, so the weirdness is worth it // but get_ref_mut approach saves a lookup, so the weirdness is worth it
desc.content = FlexVar(Some(name)); subs.modify(var, |d| {
desc.rank = max_rank; *d = Descriptor {
desc.mark = Mark::NONE; content: FlexVar(Some(name)),
desc.copy = OptVariable::NONE; rank: max_rank,
mark: Mark::NONE,
copy: OptVariable::NONE,
}
})
} }
&RigidAbleVar(name, ability) => { &RigidAbleVar(name, ability) => {
// Same as `RigidVar` above // Same as `RigidVar` above
desc.content = FlexAbleVar(Some(name), ability); subs.modify(var, |d| {
desc.rank = max_rank; *d = Descriptor {
desc.mark = Mark::NONE; content: FlexAbleVar(Some(name), ability),
desc.copy = OptVariable::NONE; rank: max_rank,
mark: Mark::NONE,
copy: OptVariable::NONE,
}
})
} }
FlexVar(_) | FlexAbleVar(_, _) | Error => (), FlexVar(_) | FlexAbleVar(_, _) | Error => (),