]> git.lizzy.rs Git - rust.git/commitdiff
Auto merge of #51855 - Eh2406:i51821, r=nikomatsakis
authorbors <bors@rust-lang.org>
Sun, 1 Jul 2018 10:41:51 +0000 (10:41 +0000)
committerbors <bors@rust-lang.org>
Sun, 1 Jul 2018 10:41:51 +0000 (10:41 +0000)
A fix for 51821

This dedupe the vec of `OutlivesConstraint` using a `FxHashSet<(RegionVid, RegionVid)>` it alsow adds a `struct ConstraintSet` to encapsulate/ensure this behavere.

1  2 
src/librustc_mir/borrow_check/nll/type_check/mod.rs

index 9b6e3e0cab6baa5c8ba650f585fc54c80e7db08b,ee607ccae89744defcd16647e7d9045f5e9efc49..611050a406020e87e65ea77efc90ec9035062f9a
  #![allow(unreachable_code)]
  
  use borrow_check::location::LocationTable;
+ use borrow_check::nll::constraint_set::ConstraintSet;
  use borrow_check::nll::facts::AllFacts;
  use borrow_check::nll::region_infer::Cause;
- use borrow_check::nll::region_infer::{ClosureRegionRequirementsExt, OutlivesConstraint, TypeTest};
+ use borrow_check::nll::region_infer::{ClosureRegionRequirementsExt, TypeTest};
  use borrow_check::nll::universal_regions::UniversalRegions;
  use dataflow::move_paths::MoveData;
  use dataflow::FlowAtLocation;
@@@ -190,7 -191,7 +191,7 @@@ struct TypeVerifier<'a, 'b: 'a, 'gcx: '
  
  impl<'a, 'b, 'gcx, 'tcx> Visitor<'tcx> for TypeVerifier<'a, 'b, 'gcx, 'tcx> {
      fn visit_span(&mut self, span: &Span) {
 -        if *span != DUMMY_SP {
 +        if !span.is_dummy() {
              self.last_span = *span;
          }
      }
@@@ -621,7 -622,7 +622,7 @@@ crate struct MirTypeckRegionConstraints
      /// hence it must report on their liveness constraints.
      crate liveness_set: Vec<(ty::Region<'tcx>, Location, Cause)>,
  
-     crate outlives_constraints: Vec<OutlivesConstraint>,
+     crate outlives_constraints: ConstraintSet,
  
      crate type_tests: Vec<TypeTest<'tcx>>,
  }
@@@ -1601,7 -1602,7 +1602,7 @@@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'g
                  statement_index: 0,
              };
              for stmt in &block_data.statements {
 -                if stmt.source_info.span != DUMMY_SP {
 +                if !stmt.source_info.span.is_dummy() {
                      self.last_span = stmt.source_info.span;
                  }
                  self.check_stmt(mir, stmt, location);