Skip to content

Commit dcbb27a

Browse files
committed
fix the bug in region_inference where constraint origins were being overwritten
1 parent 7f8b003 commit dcbb27a

File tree

1 file changed

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

1 file changed

+3
-2
lines changed

src/librustc/infer/region_inference/mod.rs

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

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

636-
if self.constraints.borrow_mut().insert(constraint, origin).is_none() {
636+
self.constraints.borrow_mut().entry(constraint).or_insert_with(|| {
637637
if self.in_snapshot() {
638638
self.undo_log.borrow_mut().push(AddConstraint(constraint));
639639
}
640-
}
640+
origin
641+
});
641642
}
642643

643644
fn add_verify(&self, verify: Verify<'tcx>) {

0 commit comments

Comments
 (0)