Skip to content

Commit 5d170f0

Browse files
committed
add a comment explaining the bugfix to infer::region_inference::add_constraint
1 parent c046fda commit 5d170f0

File tree

1 file changed

+3
-0
lines changed
  • src/librustc/infer/region_inference

1 file changed

+3
-0
lines changed

src/librustc/infer/region_inference/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -633,6 +633,9 @@ impl<'a, 'gcx, 'tcx> RegionVarBindings<'a, 'gcx, 'tcx> {
633633

634634
debug!("RegionVarBindings: add_constraint({:?})", constraint);
635635

636+
// never overwrite an existing (constraint, origin) - only insert one if it isn't
637+
// present in the map yet. This prevents origins from outside the snapshot being
638+
// replaced with "less informative" origins e.g. during calls to `can_eq`
636639
self.constraints.borrow_mut().entry(constraint).or_insert_with(|| {
637640
if self.in_snapshot() {
638641
self.undo_log.borrow_mut().push(AddConstraint(constraint));

0 commit comments

Comments
 (0)