add a comment explaining the bugfix to infer::region_inference::add_constraint

This commit is contained in:
Michael Hewson 2017-11-09 09:56:14 -05:00
parent c046fda312
commit 5d170f0a3c
1 changed files with 3 additions and 0 deletions

View File

@ -633,6 +633,9 @@ impl<'a, 'gcx, 'tcx> RegionVarBindings<'a, 'gcx, 'tcx> {
debug!("RegionVarBindings: add_constraint({:?})", constraint);
// never overwrite an existing (constraint, origin) - only insert one if it isn't
// present in the map yet. This prevents origins from outside the snapshot being
// replaced with "less informative" origins e.g. during calls to `can_eq`
self.constraints.borrow_mut().entry(constraint).or_insert_with(|| {
if self.in_snapshot() {
self.undo_log.borrow_mut().push(AddConstraint(constraint));