I noticed that constraints, constraint_graph and universal_region_relations (all members of the RegionInferenceContext struct) are wrapped in Rcs, but it doesn't seem necessary - none of them are cloned anywhere. I thought this might be done in order to reduce the size of the RegionInferenceContext struct, but the same could also be done to its other components that are bigger than Rc as well.
A comment in region_infer::mod.rs suggests that using an Rc "freezes constraints", but if they are just to be frozen a plain immutable reference could used instead, no?
cc @nnethercote
I noticed that
constraints,constraint_graphanduniversal_region_relations(all members of theRegionInferenceContextstruct) are wrapped inRcs, but it doesn't seem necessary - none of them arecloned anywhere. I thought this might be done in order to reduce the size of theRegionInferenceContextstruct, but the same could also be done to its other components that are bigger thanRcas well.A comment in
region_infer::mod.rssuggests that using anRc"freezes constraints", but if they are just to be frozen a plain immutable reference could used instead, no?cc @nnethercote