From 52a9eff7ad442ef89da2aa7e818de56b5c72e031 Mon Sep 17 00:00:00 2001
From: Mark Mansi <markm@cs.wisc.edu>
Date: Fri, 29 Nov 2019 19:05:44 -0600
Subject: [PATCH 1/6] get rid of nll submod

---
 src/librustc_mir/borrow_check/{nll => }/constraint_generation.rs  | 0
 src/librustc_mir/borrow_check/{nll => }/constraints/graph.rs      | 0
 src/librustc_mir/borrow_check/{nll => }/constraints/mod.rs        | 0
 src/librustc_mir/borrow_check/{nll => }/facts.rs                  | 0
 src/librustc_mir/borrow_check/{nll => }/invalidation.rs           | 0
 src/librustc_mir/borrow_check/{nll => }/member_constraints.rs     | 0
 src/librustc_mir/borrow_check/{nll/mod.rs => nll.rs}              | 0
 src/librustc_mir/borrow_check/{nll => }/region_infer/dump_mir.rs  | 0
 src/librustc_mir/borrow_check/{nll => }/region_infer/graphviz.rs  | 0
 src/librustc_mir/borrow_check/{nll => }/region_infer/mod.rs       | 0
 src/librustc_mir/borrow_check/{nll => }/region_infer/values.rs    | 0
 src/librustc_mir/borrow_check/{nll => }/renumber.rs               | 0
 .../borrow_check/{nll => }/type_check/constraint_conversion.rs    | 0
 .../borrow_check/{nll => }/type_check/free_region_relations.rs    | 0
 .../borrow_check/{nll => }/type_check/input_output.rs             | 0
 .../borrow_check/{nll => }/type_check/liveness/local_use_map.rs   | 0
 .../borrow_check/{nll => }/type_check/liveness/mod.rs             | 0
 .../borrow_check/{nll => }/type_check/liveness/polonius.rs        | 0
 .../borrow_check/{nll => }/type_check/liveness/trace.rs           | 0
 src/librustc_mir/borrow_check/{nll => }/type_check/mod.rs         | 0
 src/librustc_mir/borrow_check/{nll => }/type_check/relate_tys.rs  | 0
 src/librustc_mir/borrow_check/{nll => }/universal_regions.rs      | 0
 22 files changed, 0 insertions(+), 0 deletions(-)
 rename src/librustc_mir/borrow_check/{nll => }/constraint_generation.rs (100%)
 rename src/librustc_mir/borrow_check/{nll => }/constraints/graph.rs (100%)
 rename src/librustc_mir/borrow_check/{nll => }/constraints/mod.rs (100%)
 rename src/librustc_mir/borrow_check/{nll => }/facts.rs (100%)
 rename src/librustc_mir/borrow_check/{nll => }/invalidation.rs (100%)
 rename src/librustc_mir/borrow_check/{nll => }/member_constraints.rs (100%)
 rename src/librustc_mir/borrow_check/{nll/mod.rs => nll.rs} (100%)
 rename src/librustc_mir/borrow_check/{nll => }/region_infer/dump_mir.rs (100%)
 rename src/librustc_mir/borrow_check/{nll => }/region_infer/graphviz.rs (100%)
 rename src/librustc_mir/borrow_check/{nll => }/region_infer/mod.rs (100%)
 rename src/librustc_mir/borrow_check/{nll => }/region_infer/values.rs (100%)
 rename src/librustc_mir/borrow_check/{nll => }/renumber.rs (100%)
 rename src/librustc_mir/borrow_check/{nll => }/type_check/constraint_conversion.rs (100%)
 rename src/librustc_mir/borrow_check/{nll => }/type_check/free_region_relations.rs (100%)
 rename src/librustc_mir/borrow_check/{nll => }/type_check/input_output.rs (100%)
 rename src/librustc_mir/borrow_check/{nll => }/type_check/liveness/local_use_map.rs (100%)
 rename src/librustc_mir/borrow_check/{nll => }/type_check/liveness/mod.rs (100%)
 rename src/librustc_mir/borrow_check/{nll => }/type_check/liveness/polonius.rs (100%)
 rename src/librustc_mir/borrow_check/{nll => }/type_check/liveness/trace.rs (100%)
 rename src/librustc_mir/borrow_check/{nll => }/type_check/mod.rs (100%)
 rename src/librustc_mir/borrow_check/{nll => }/type_check/relate_tys.rs (100%)
 rename src/librustc_mir/borrow_check/{nll => }/universal_regions.rs (100%)

diff --git a/src/librustc_mir/borrow_check/nll/constraint_generation.rs b/src/librustc_mir/borrow_check/constraint_generation.rs
similarity index 100%
rename from src/librustc_mir/borrow_check/nll/constraint_generation.rs
rename to src/librustc_mir/borrow_check/constraint_generation.rs
diff --git a/src/librustc_mir/borrow_check/nll/constraints/graph.rs b/src/librustc_mir/borrow_check/constraints/graph.rs
similarity index 100%
rename from src/librustc_mir/borrow_check/nll/constraints/graph.rs
rename to src/librustc_mir/borrow_check/constraints/graph.rs
diff --git a/src/librustc_mir/borrow_check/nll/constraints/mod.rs b/src/librustc_mir/borrow_check/constraints/mod.rs
similarity index 100%
rename from src/librustc_mir/borrow_check/nll/constraints/mod.rs
rename to src/librustc_mir/borrow_check/constraints/mod.rs
diff --git a/src/librustc_mir/borrow_check/nll/facts.rs b/src/librustc_mir/borrow_check/facts.rs
similarity index 100%
rename from src/librustc_mir/borrow_check/nll/facts.rs
rename to src/librustc_mir/borrow_check/facts.rs
diff --git a/src/librustc_mir/borrow_check/nll/invalidation.rs b/src/librustc_mir/borrow_check/invalidation.rs
similarity index 100%
rename from src/librustc_mir/borrow_check/nll/invalidation.rs
rename to src/librustc_mir/borrow_check/invalidation.rs
diff --git a/src/librustc_mir/borrow_check/nll/member_constraints.rs b/src/librustc_mir/borrow_check/member_constraints.rs
similarity index 100%
rename from src/librustc_mir/borrow_check/nll/member_constraints.rs
rename to src/librustc_mir/borrow_check/member_constraints.rs
diff --git a/src/librustc_mir/borrow_check/nll/mod.rs b/src/librustc_mir/borrow_check/nll.rs
similarity index 100%
rename from src/librustc_mir/borrow_check/nll/mod.rs
rename to src/librustc_mir/borrow_check/nll.rs
diff --git a/src/librustc_mir/borrow_check/nll/region_infer/dump_mir.rs b/src/librustc_mir/borrow_check/region_infer/dump_mir.rs
similarity index 100%
rename from src/librustc_mir/borrow_check/nll/region_infer/dump_mir.rs
rename to src/librustc_mir/borrow_check/region_infer/dump_mir.rs
diff --git a/src/librustc_mir/borrow_check/nll/region_infer/graphviz.rs b/src/librustc_mir/borrow_check/region_infer/graphviz.rs
similarity index 100%
rename from src/librustc_mir/borrow_check/nll/region_infer/graphviz.rs
rename to src/librustc_mir/borrow_check/region_infer/graphviz.rs
diff --git a/src/librustc_mir/borrow_check/nll/region_infer/mod.rs b/src/librustc_mir/borrow_check/region_infer/mod.rs
similarity index 100%
rename from src/librustc_mir/borrow_check/nll/region_infer/mod.rs
rename to src/librustc_mir/borrow_check/region_infer/mod.rs
diff --git a/src/librustc_mir/borrow_check/nll/region_infer/values.rs b/src/librustc_mir/borrow_check/region_infer/values.rs
similarity index 100%
rename from src/librustc_mir/borrow_check/nll/region_infer/values.rs
rename to src/librustc_mir/borrow_check/region_infer/values.rs
diff --git a/src/librustc_mir/borrow_check/nll/renumber.rs b/src/librustc_mir/borrow_check/renumber.rs
similarity index 100%
rename from src/librustc_mir/borrow_check/nll/renumber.rs
rename to src/librustc_mir/borrow_check/renumber.rs
diff --git a/src/librustc_mir/borrow_check/nll/type_check/constraint_conversion.rs b/src/librustc_mir/borrow_check/type_check/constraint_conversion.rs
similarity index 100%
rename from src/librustc_mir/borrow_check/nll/type_check/constraint_conversion.rs
rename to src/librustc_mir/borrow_check/type_check/constraint_conversion.rs
diff --git a/src/librustc_mir/borrow_check/nll/type_check/free_region_relations.rs b/src/librustc_mir/borrow_check/type_check/free_region_relations.rs
similarity index 100%
rename from src/librustc_mir/borrow_check/nll/type_check/free_region_relations.rs
rename to src/librustc_mir/borrow_check/type_check/free_region_relations.rs
diff --git a/src/librustc_mir/borrow_check/nll/type_check/input_output.rs b/src/librustc_mir/borrow_check/type_check/input_output.rs
similarity index 100%
rename from src/librustc_mir/borrow_check/nll/type_check/input_output.rs
rename to src/librustc_mir/borrow_check/type_check/input_output.rs
diff --git a/src/librustc_mir/borrow_check/nll/type_check/liveness/local_use_map.rs b/src/librustc_mir/borrow_check/type_check/liveness/local_use_map.rs
similarity index 100%
rename from src/librustc_mir/borrow_check/nll/type_check/liveness/local_use_map.rs
rename to src/librustc_mir/borrow_check/type_check/liveness/local_use_map.rs
diff --git a/src/librustc_mir/borrow_check/nll/type_check/liveness/mod.rs b/src/librustc_mir/borrow_check/type_check/liveness/mod.rs
similarity index 100%
rename from src/librustc_mir/borrow_check/nll/type_check/liveness/mod.rs
rename to src/librustc_mir/borrow_check/type_check/liveness/mod.rs
diff --git a/src/librustc_mir/borrow_check/nll/type_check/liveness/polonius.rs b/src/librustc_mir/borrow_check/type_check/liveness/polonius.rs
similarity index 100%
rename from src/librustc_mir/borrow_check/nll/type_check/liveness/polonius.rs
rename to src/librustc_mir/borrow_check/type_check/liveness/polonius.rs
diff --git a/src/librustc_mir/borrow_check/nll/type_check/liveness/trace.rs b/src/librustc_mir/borrow_check/type_check/liveness/trace.rs
similarity index 100%
rename from src/librustc_mir/borrow_check/nll/type_check/liveness/trace.rs
rename to src/librustc_mir/borrow_check/type_check/liveness/trace.rs
diff --git a/src/librustc_mir/borrow_check/nll/type_check/mod.rs b/src/librustc_mir/borrow_check/type_check/mod.rs
similarity index 100%
rename from src/librustc_mir/borrow_check/nll/type_check/mod.rs
rename to src/librustc_mir/borrow_check/type_check/mod.rs
diff --git a/src/librustc_mir/borrow_check/nll/type_check/relate_tys.rs b/src/librustc_mir/borrow_check/type_check/relate_tys.rs
similarity index 100%
rename from src/librustc_mir/borrow_check/nll/type_check/relate_tys.rs
rename to src/librustc_mir/borrow_check/type_check/relate_tys.rs
diff --git a/src/librustc_mir/borrow_check/nll/universal_regions.rs b/src/librustc_mir/borrow_check/universal_regions.rs
similarity index 100%
rename from src/librustc_mir/borrow_check/nll/universal_regions.rs
rename to src/librustc_mir/borrow_check/universal_regions.rs

From 697853117fc959793eb466d029086a7ba9ebc348 Mon Sep 17 00:00:00 2001
From: Mark Mansi <markm@cs.wisc.edu>
Date: Fri, 29 Nov 2019 19:48:29 -0600
Subject: [PATCH 2/6] fix imports

---
 .../borrow_check/constraint_generation.rs     | 15 ++++---
 .../borrow_check/constraints/graph.rs         |  9 ++--
 .../borrow_check/constraints/mod.rs           |  3 +-
 .../diagnostics/explain_borrow.rs             | 13 ++++--
 .../borrow_check/diagnostics/find_use.rs      |  3 +-
 .../diagnostics/outlives_suggestion.rs        |  2 +-
 .../borrow_check/diagnostics/region_errors.rs | 20 +++++----
 .../borrow_check/diagnostics/region_name.rs   |  7 ++--
 .../borrow_check/diagnostics/var_name.rs      |  3 +-
 src/librustc_mir/borrow_check/invalidation.rs | 22 +++++-----
 src/librustc_mir/borrow_check/mod.rs          | 21 +++++++---
 src/librustc_mir/borrow_check/nll.rs          | 42 ++++++++-----------
 .../borrow_check/region_infer/graphviz.rs     |  5 ++-
 .../borrow_check/region_infer/mod.rs          | 29 ++++++-------
 .../type_check/constraint_conversion.rs       | 13 +++---
 .../type_check/free_region_relations.rs       | 12 ++++--
 .../borrow_check/type_check/input_output.rs   |  3 +-
 .../type_check/liveness/local_use_map.rs      |  6 ++-
 .../borrow_check/type_check/liveness/mod.rs   | 22 ++++++----
 .../borrow_check/type_check/liveness/trace.rs | 20 +++++----
 .../borrow_check/type_check/mod.rs            | 25 ++++++++++-
 .../borrow_check/type_check/relate_tys.rs     |  5 ++-
 .../borrow_check/universal_regions.rs         |  2 +-
 src/librustc_mir/dataflow/impls/borrows.rs    | 14 ++++---
 24 files changed, 187 insertions(+), 129 deletions(-)

diff --git a/src/librustc_mir/borrow_check/constraint_generation.rs b/src/librustc_mir/borrow_check/constraint_generation.rs
index dbeccab966bbb..28a631a711a87 100644
--- a/src/librustc_mir/borrow_check/constraint_generation.rs
+++ b/src/librustc_mir/borrow_check/constraint_generation.rs
@@ -1,9 +1,3 @@
-use crate::borrow_check::borrow_set::BorrowSet;
-use crate::borrow_check::location::LocationTable;
-use crate::borrow_check::nll::ToRegionVid;
-use crate::borrow_check::nll::facts::AllFacts;
-use crate::borrow_check::nll::region_infer::values::LivenessValues;
-use crate::borrow_check::places_conflict;
 use rustc::infer::InferCtxt;
 use rustc::mir::visit::TyContext;
 use rustc::mir::visit::Visitor;
@@ -15,6 +9,15 @@ use rustc::ty::fold::TypeFoldable;
 use rustc::ty::{self, RegionVid, Ty};
 use rustc::ty::subst::SubstsRef;
 
+use crate::borrow_check::{
+    borrow_set::BorrowSet,
+    location::LocationTable,
+    nll::ToRegionVid,
+    facts::AllFacts,
+    region_infer::values::LivenessValues,
+    places_conflict,
+};
+
 pub(super) fn generate_constraints<'cx, 'tcx>(
     infcx: &InferCtxt<'cx, 'tcx>,
     param_env: ty::ParamEnv<'tcx>,
diff --git a/src/librustc_mir/borrow_check/constraints/graph.rs b/src/librustc_mir/borrow_check/constraints/graph.rs
index b6a9a7ee6578f..3e7aa67ef6c7d 100644
--- a/src/librustc_mir/borrow_check/constraints/graph.rs
+++ b/src/librustc_mir/borrow_check/constraints/graph.rs
@@ -1,12 +1,15 @@
-use crate::borrow_check::nll::type_check::Locations;
-use crate::borrow_check::nll::constraints::OutlivesConstraintIndex;
-use crate::borrow_check::nll::constraints::{OutlivesConstraintSet, OutlivesConstraint};
 use rustc::mir::ConstraintCategory;
 use rustc::ty::RegionVid;
 use rustc_data_structures::graph;
 use rustc_index::vec::IndexVec;
 use syntax_pos::DUMMY_SP;
 
+use crate::borrow_check::{
+    type_check::Locations,
+    constraints::OutlivesConstraintIndex,
+    constraints::{OutlivesConstraintSet, OutlivesConstraint},
+};
+
 /// The construct graph organizes the constraints by their end-points.
 /// It can be used to view a `R1: R2` constraint as either an edge `R1
 /// -> R2` or `R2 -> R1` depending on the direction type `D`.
diff --git a/src/librustc_mir/borrow_check/constraints/mod.rs b/src/librustc_mir/borrow_check/constraints/mod.rs
index 8a242b7ee25ba..96982b604c0be 100644
--- a/src/librustc_mir/borrow_check/constraints/mod.rs
+++ b/src/librustc_mir/borrow_check/constraints/mod.rs
@@ -1,4 +1,3 @@
-use crate::borrow_check::nll::type_check::Locations;
 use rustc::mir::ConstraintCategory;
 use rustc::ty::RegionVid;
 use rustc_data_structures::graph::scc::Sccs;
@@ -6,6 +5,8 @@ use rustc_index::vec::{Idx, IndexVec};
 use std::fmt;
 use std::ops::Index;
 
+use crate::borrow_check::type_check::Locations;
+
 crate mod graph;
 
 /// A set of NLL region constraints. These include "outlives"
diff --git a/src/librustc_mir/borrow_check/diagnostics/explain_borrow.rs b/src/librustc_mir/borrow_check/diagnostics/explain_borrow.rs
index 67c3c36e73ec7..a463d2cb2990b 100644
--- a/src/librustc_mir/borrow_check/diagnostics/explain_borrow.rs
+++ b/src/librustc_mir/borrow_check/diagnostics/explain_borrow.rs
@@ -1,9 +1,7 @@
+//! Print diagnostics to explain why values are borrowed.
+
 use std::collections::VecDeque;
 
-use crate::borrow_check::borrow_set::BorrowData;
-use crate::borrow_check::nll::region_infer::Cause;
-use crate::borrow_check::nll::ConstraintDescription;
-use crate::borrow_check::{MirBorrowckCtxt, WriteKind};
 use rustc::mir::{
     CastKind, ConstraintCategory, FakeReadCause, Local, Location, Body, Operand, Place, Rvalue,
     Statement, StatementKind, TerminatorKind,
@@ -16,6 +14,13 @@ use rustc_errors::DiagnosticBuilder;
 use syntax_pos::Span;
 use syntax_pos::symbol::Symbol;
 
+use crate::borrow_check::{
+    borrow_set::BorrowData,
+    region_infer::Cause,
+    nll::ConstraintDescription,
+    MirBorrowckCtxt, WriteKind,
+};
+
 use super::{UseSpans, find_use, RegionName};
 
 #[derive(Debug)]
diff --git a/src/librustc_mir/borrow_check/diagnostics/find_use.rs b/src/librustc_mir/borrow_check/diagnostics/find_use.rs
index 7ab069260f940..c557e528768c5 100644
--- a/src/librustc_mir/borrow_check/diagnostics/find_use.rs
+++ b/src/librustc_mir/borrow_check/diagnostics/find_use.rs
@@ -1,8 +1,7 @@
 use std::collections::VecDeque;
 use std::rc::Rc;
 
-use crate::borrow_check::nll::region_infer::{Cause, RegionInferenceContext};
-use crate::borrow_check::nll::ToRegionVid;
+use crate::borrow_check::{nll::ToRegionVid, region_infer::{Cause, RegionInferenceContext}};
 use crate::util::liveness::{self, DefUse};
 use rustc::mir::visit::{MirVisitable, PlaceContext, Visitor};
 use rustc::mir::{Local, Location, Body};
diff --git a/src/librustc_mir/borrow_check/diagnostics/outlives_suggestion.rs b/src/librustc_mir/borrow_check/diagnostics/outlives_suggestion.rs
index 7aecadae98b55..b61c37b061396 100644
--- a/src/librustc_mir/borrow_check/diagnostics/outlives_suggestion.rs
+++ b/src/librustc_mir/borrow_check/diagnostics/outlives_suggestion.rs
@@ -13,7 +13,7 @@ use syntax_pos::symbol::Symbol;
 
 use smallvec::SmallVec;
 
-use crate::borrow_check::nll::region_infer::RegionInferenceContext;
+use crate::borrow_check::region_infer::RegionInferenceContext;
 
 use super::{
     RegionName, RegionNameSource, ErrorConstraintInfo, ErrorReportingCtx, RegionErrorNamingCtx,
diff --git a/src/librustc_mir/borrow_check/diagnostics/region_errors.rs b/src/librustc_mir/borrow_check/diagnostics/region_errors.rs
index 66f0330fe9b6c..8a37e2d02ec71 100644
--- a/src/librustc_mir/borrow_check/diagnostics/region_errors.rs
+++ b/src/librustc_mir/borrow_check/diagnostics/region_errors.rs
@@ -1,10 +1,5 @@
-use crate::borrow_check::nll::constraints::OutlivesConstraint;
-use crate::borrow_check::nll::region_infer::RegionInferenceContext;
-use crate::borrow_check::nll::type_check::Locations;
-use crate::borrow_check::nll::universal_regions::DefiningTy;
-use crate::borrow_check::nll::ConstraintDescription;
-use crate::borrow_check::Upvar;
-use crate::util::borrowck_errors;
+//! Error reporting machinery for lifetime errors.
+
 use rustc::hir::def_id::DefId;
 use rustc::infer::error_reporting::nice_region_error::NiceRegionError;
 use rustc::infer::InferCtxt;
@@ -19,6 +14,17 @@ use syntax::symbol::kw;
 use syntax_pos::Span;
 use syntax_pos::symbol::Symbol;
 
+use crate::util::borrowck_errors;
+
+use crate::borrow_check::{
+    constraints::OutlivesConstraint,
+    region_infer::RegionInferenceContext,
+    type_check::Locations,
+    universal_regions::DefiningTy,
+    nll::ConstraintDescription,
+    Upvar,
+};
+
 use super::{OutlivesSuggestionBuilder, RegionName, RegionNameSource, RegionErrorNamingCtx};
 
 impl ConstraintDescription for ConstraintCategory {
diff --git a/src/librustc_mir/borrow_check/diagnostics/region_name.rs b/src/librustc_mir/borrow_check/diagnostics/region_name.rs
index e2e75962aecef..720c77beaf8b5 100644
--- a/src/librustc_mir/borrow_check/diagnostics/region_name.rs
+++ b/src/librustc_mir/borrow_check/diagnostics/region_name.rs
@@ -15,14 +15,13 @@ use rustc_data_structures::fx::FxHashMap;
 use syntax_pos::{Span, symbol::Symbol, DUMMY_SP};
 
 use crate::borrow_check::{
-    nll::region_infer::RegionInferenceContext,
-    nll::universal_regions::DefiningTy,
+    diagnostics::region_errors::ErrorReportingCtx,
+    region_infer::RegionInferenceContext,
+    universal_regions::DefiningTy,
     nll::ToRegionVid,
     Upvar,
 };
 
-use super::region_errors::ErrorReportingCtx;
-
 /// A name for a particular region used in emitting diagnostics. This name could be a generated
 /// name like `'1`, a name used by the user like `'a`, or a name like `'static`.
 #[derive(Debug, Clone)]
diff --git a/src/librustc_mir/borrow_check/diagnostics/var_name.rs b/src/librustc_mir/borrow_check/diagnostics/var_name.rs
index 1ac44c4fdb101..839e09be7af82 100644
--- a/src/librustc_mir/borrow_check/diagnostics/var_name.rs
+++ b/src/librustc_mir/borrow_check/diagnostics/var_name.rs
@@ -1,5 +1,4 @@
-use crate::borrow_check::nll::region_infer::RegionInferenceContext;
-use crate::borrow_check::nll::ToRegionVid;
+use crate::borrow_check::{nll::ToRegionVid, region_infer::RegionInferenceContext};
 use crate::borrow_check::Upvar;
 use rustc::mir::{Local, Body};
 use rustc::ty::{RegionVid, TyCtxt};
diff --git a/src/librustc_mir/borrow_check/invalidation.rs b/src/librustc_mir/borrow_check/invalidation.rs
index e442f9c9e322f..58fac5512d9b6 100644
--- a/src/librustc_mir/borrow_check/invalidation.rs
+++ b/src/librustc_mir/borrow_check/invalidation.rs
@@ -1,14 +1,3 @@
-use crate::borrow_check::borrow_set::BorrowSet;
-use crate::borrow_check::location::LocationTable;
-use crate::borrow_check::{JustWrite, WriteAndRead};
-use crate::borrow_check::{AccessDepth, Deep, Shallow};
-use crate::borrow_check::{ReadOrWrite, Activation, Read, Reservation, Write};
-use crate::borrow_check::{LocalMutationIsAllowed, MutateMode};
-use crate::borrow_check::ArtificialField;
-use crate::borrow_check::{ReadKind, WriteKind};
-use crate::borrow_check::nll::facts::AllFacts;
-use crate::borrow_check::path_utils::*;
-use crate::dataflow::indexes::BorrowIndex;
 use rustc::ty::{self, TyCtxt};
 use rustc::mir::visit::Visitor;
 use rustc::mir::{BasicBlock, Location, Body, Place, ReadOnlyBodyAndCache, Rvalue};
@@ -17,6 +6,17 @@ use rustc::mir::TerminatorKind;
 use rustc::mir::{Operand, BorrowKind};
 use rustc_data_structures::graph::dominators::Dominators;
 
+use crate::dataflow::indexes::BorrowIndex;
+
+use crate::borrow_check::{
+    borrow_set::BorrowSet,
+    location::LocationTable,
+    facts::AllFacts,
+    path_utils::*,
+    JustWrite, WriteAndRead, AccessDepth, Deep, Shallow, ReadOrWrite, Activation, Read,
+    Reservation, Write, LocalMutationIsAllowed, MutateMode, ArtificialField, ReadKind, WriteKind,
+};
+
 pub(super) fn generate_invalidates<'tcx>(
     tcx: TyCtxt<'tcx>,
     param_env: ty::ParamEnv<'tcx>,
diff --git a/src/librustc_mir/borrow_check/mod.rs b/src/librustc_mir/borrow_check/mod.rs
index b4f2e2377ac7d..fb26effc0bc96 100644
--- a/src/librustc_mir/borrow_check/mod.rs
+++ b/src/librustc_mir/borrow_check/mod.rs
@@ -1,6 +1,5 @@
 //! This query borrow-checks the MIR to (further) ensure it is not broken.
 
-use crate::borrow_check::nll::region_infer::RegionInferenceContext;
 use rustc::hir::{self, HirId};
 use rustc::hir::Node;
 use rustc::hir::def_id::DefId;
@@ -47,20 +46,30 @@ use self::location::LocationTable;
 use self::prefixes::PrefixSet;
 use self::MutateMode::{JustWrite, WriteAndRead};
 use self::diagnostics::AccessKind;
+use self::region_infer::RegionInferenceContext;
 
 use self::path_utils::*;
 
-crate mod borrow_set;
 mod diagnostics;
 mod flows;
 mod location;
 mod path_utils;
-crate mod place_ext;
-crate mod places_conflict;
 mod prefixes;
 mod used_muts;
-
-pub(crate) mod nll;
+mod constraint_generation;
+mod facts;
+mod invalidation;
+mod renumber;
+mod member_constraints;
+
+crate mod constraints;
+crate mod universal_regions;
+crate mod type_check;
+crate mod region_infer;
+crate mod borrow_set;
+crate mod place_ext;
+crate mod places_conflict;
+crate mod nll;
 
 // FIXME(eddyb) perhaps move this somewhere more centrally.
 #[derive(Debug)]
diff --git a/src/librustc_mir/borrow_check/nll.rs b/src/librustc_mir/borrow_check/nll.rs
index 9ea3bd8899b9d..61e6b4c863180 100644
--- a/src/librustc_mir/borrow_check/nll.rs
+++ b/src/librustc_mir/borrow_check/nll.rs
@@ -1,13 +1,5 @@
-use crate::borrow_check::borrow_set::BorrowSet;
-use crate::borrow_check::location::LocationTable;
-use crate::borrow_check::nll::facts::AllFactsExt;
-use crate::borrow_check::nll::type_check::{MirTypeckResults, MirTypeckRegionConstraints};
-use crate::borrow_check::nll::region_infer::values::RegionValueElements;
-use crate::dataflow::move_paths::{InitLocation, MoveData, InitKind};
-use crate::dataflow::FlowAtLocation;
-use crate::dataflow::MaybeInitializedPlaces;
-use crate::transform::MirSource;
-use crate::borrow_check::Upvar;
+//! The entry point of the NLL borrow checker.
+
 use rustc::hir::def_id::DefId;
 use rustc::infer::InferCtxt;
 use rustc::mir::{ClosureOutlivesSubject, ClosureRegionRequirements,
@@ -27,24 +19,24 @@ use syntax::symbol::sym;
 
 use self::mir_util::PassWhere;
 use polonius_engine::{Algorithm, Output};
+
 use crate::util as mir_util;
 use crate::util::pretty;
+use crate::dataflow::indexes::BorrowIndex;
+use crate::dataflow::move_paths::{InitLocation, MoveData, MovePathIndex, InitKind};
+use crate::dataflow::FlowAtLocation;
+use crate::dataflow::MaybeInitializedPlaces;
+use crate::transform::MirSource;
 
-mod constraint_generation;
-mod facts;
-mod invalidation;
-mod renumber;
-
-mod member_constraints;
-
-crate mod constraints;
-crate mod universal_regions;
-crate mod type_check;
-crate mod region_infer;
-
-use self::facts::{AllFacts, RustcFacts};
-use self::region_infer::RegionInferenceContext;
-use self::universal_regions::UniversalRegions;
+use crate::borrow_check::{
+    borrow_set::BorrowSet,
+    location::{LocationIndex, LocationTable},
+    facts::{AllFacts, AllFactsExt, RustcFacts},
+    region_infer::{RegionInferenceContext, values::RegionValueElements},
+    universal_regions::UniversalRegions,
+    type_check::{self, MirTypeckResults, MirTypeckRegionConstraints},
+    Upvar, renumber, constraint_generation, invalidation,
+};
 
 crate type PoloniusOutput = Output<RustcFacts>;
 
diff --git a/src/librustc_mir/borrow_check/region_infer/graphviz.rs b/src/librustc_mir/borrow_check/region_infer/graphviz.rs
index fdf2af9f44ebc..29c6f32526390 100644
--- a/src/librustc_mir/borrow_check/region_infer/graphviz.rs
+++ b/src/librustc_mir/borrow_check/region_infer/graphviz.rs
@@ -2,11 +2,12 @@
 //! libgraphviz traits, specialized to attaching borrowck analysis
 //! data to rendered labels.
 
-use super::*;
-use crate::borrow_check::nll::constraints::OutlivesConstraint;
 use std::borrow::Cow;
 use std::io::{self, Write};
 
+use super::*;
+use crate::borrow_check::constraints::OutlivesConstraint;
+
 impl<'tcx> RegionInferenceContext<'tcx> {
     /// Write out the region constraint graph.
     crate fn dump_graphviz_raw_constraints(&self, mut w: &mut dyn Write) -> io::Result<()> {
diff --git a/src/librustc_mir/borrow_check/region_infer/mod.rs b/src/librustc_mir/borrow_check/region_infer/mod.rs
index d62537b1ad465..b6946e2f73fc6 100644
--- a/src/librustc_mir/borrow_check/region_infer/mod.rs
+++ b/src/librustc_mir/borrow_check/region_infer/mod.rs
@@ -23,29 +23,26 @@ use syntax_pos::Span;
 use syntax_pos::symbol::Symbol;
 
 use crate::borrow_check::{
-    nll::{
-        constraints::{
-            graph::NormalConstraintGraph,
-            ConstraintSccIndex,
-            OutlivesConstraint,
-            OutlivesConstraintSet,
-        },
-        member_constraints::{MemberConstraintSet, NllMemberConstraintIndex},
-        region_infer::values::{
-            PlaceholderIndices, RegionElement, ToElementIndex
-        },
-        type_check::{free_region_relations::UniversalRegionRelations, Locations},
+    constraints::{
+        graph::NormalConstraintGraph,
+        ConstraintSccIndex,
+        OutlivesConstraint,
+        OutlivesConstraintSet,
     },
+    member_constraints::{MemberConstraintSet, NllMemberConstraintIndex},
+    region_infer::values::{
+        PlaceholderIndices, RegionElement, ToElementIndex, LivenessValues, RegionValueElements,
+        RegionValues,
+    },
+    type_check::{free_region_relations::UniversalRegionRelations, Locations},
     diagnostics::{
         OutlivesSuggestionBuilder, RegionErrorNamingCtx,
     },
+    nll::{ToRegionVid, PoloniusOutput},
+    universal_regions::UniversalRegions,
     Upvar,
 };
 
-use self::values::{LivenessValues, RegionValueElements, RegionValues};
-use super::universal_regions::UniversalRegions;
-use super::{PoloniusOutput, ToRegionVid};
-
 mod dump_mir;
 mod graphviz;
 
diff --git a/src/librustc_mir/borrow_check/type_check/constraint_conversion.rs b/src/librustc_mir/borrow_check/type_check/constraint_conversion.rs
index 34ac96beb5ca3..334477dff2362 100644
--- a/src/librustc_mir/borrow_check/type_check/constraint_conversion.rs
+++ b/src/librustc_mir/borrow_check/type_check/constraint_conversion.rs
@@ -1,8 +1,3 @@
-use crate::borrow_check::nll::constraints::OutlivesConstraint;
-use crate::borrow_check::nll::region_infer::TypeTest;
-use crate::borrow_check::nll::type_check::{Locations, MirTypeckRegionConstraints};
-use crate::borrow_check::nll::universal_regions::UniversalRegions;
-use crate::borrow_check::nll::ToRegionVid;
 use rustc::infer::canonical::QueryRegionConstraints;
 use rustc::infer::canonical::QueryOutlivesConstraint;
 use rustc::infer::outlives::env::RegionBoundPairs;
@@ -14,6 +9,14 @@ use rustc::ty::subst::GenericArgKind;
 use rustc::ty::{self, TyCtxt};
 use syntax_pos::DUMMY_SP;
 
+use crate::borrow_check::{
+    constraints::OutlivesConstraint,
+    region_infer::TypeTest,
+    type_check::{Locations, MirTypeckRegionConstraints},
+    universal_regions::UniversalRegions,
+    nll::ToRegionVid,
+};
+
 crate struct ConstraintConversion<'a, 'tcx> {
     infcx: &'a InferCtxt<'a, 'tcx>,
     tcx: TyCtxt<'tcx>,
diff --git a/src/librustc_mir/borrow_check/type_check/free_region_relations.rs b/src/librustc_mir/borrow_check/type_check/free_region_relations.rs
index 8bb68383a49ba..8bbaeaace75b6 100644
--- a/src/librustc_mir/borrow_check/type_check/free_region_relations.rs
+++ b/src/librustc_mir/borrow_check/type_check/free_region_relations.rs
@@ -1,7 +1,4 @@
-use crate::borrow_check::nll::type_check::constraint_conversion;
-use crate::borrow_check::nll::type_check::{Locations, MirTypeckRegionConstraints};
-use crate::borrow_check::nll::universal_regions::UniversalRegions;
-use crate::borrow_check::nll::ToRegionVid;
+
 use rustc::infer::canonical::QueryRegionConstraints;
 use rustc::infer::outlives::free_region_map::FreeRegionRelations;
 use rustc::infer::region_constraints::GenericKind;
@@ -14,6 +11,13 @@ use rustc_data_structures::transitive_relation::TransitiveRelation;
 use std::rc::Rc;
 use syntax_pos::DUMMY_SP;
 
+use crate::borrow_check::{
+    type_check::constraint_conversion,
+    type_check::{Locations, MirTypeckRegionConstraints},
+    universal_regions::UniversalRegions,
+    nll::ToRegionVid,
+};
+
 #[derive(Debug)]
 crate struct UniversalRegionRelations<'tcx> {
     universal_regions: Rc<UniversalRegions<'tcx>>,
diff --git a/src/librustc_mir/borrow_check/type_check/input_output.rs b/src/librustc_mir/borrow_check/type_check/input_output.rs
index 35fb677c053cb..3df04909d0d2f 100644
--- a/src/librustc_mir/borrow_check/type_check/input_output.rs
+++ b/src/librustc_mir/borrow_check/type_check/input_output.rs
@@ -7,7 +7,6 @@
 //! `RETURN_PLACE` the MIR arguments) are always fully normalized (and
 //! contain revealed `impl Trait` values).
 
-use crate::borrow_check::nll::universal_regions::UniversalRegions;
 use rustc::infer::LateBoundRegionConversionTime;
 use rustc::mir::*;
 use rustc::ty::Ty;
@@ -15,6 +14,8 @@ use rustc::ty::Ty;
 use rustc_index::vec::Idx;
 use syntax_pos::Span;
 
+use crate::borrow_check::universal_regions::UniversalRegions;
+
 use super::{Locations, TypeChecker};
 
 impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
diff --git a/src/librustc_mir/borrow_check/type_check/liveness/local_use_map.rs b/src/librustc_mir/borrow_check/type_check/liveness/local_use_map.rs
index ab8c6f279733b..75e4f61245f5f 100644
--- a/src/librustc_mir/borrow_check/type_check/liveness/local_use_map.rs
+++ b/src/librustc_mir/borrow_check/type_check/liveness/local_use_map.rs
@@ -1,10 +1,12 @@
-use crate::borrow_check::nll::region_infer::values::{PointIndex, RegionValueElements};
-use crate::util::liveness::{categorize, DefUse};
 use rustc::mir::visit::{PlaceContext, Visitor};
 use rustc::mir::{Local, Location, ReadOnlyBodyAndCache};
 use rustc_index::vec::{Idx, IndexVec};
 use rustc_data_structures::vec_linked_list as vll;
 
+use crate::util::liveness::{categorize, DefUse};
+
+use crate::borrow_check::region_infer::values::{PointIndex, RegionValueElements};
+
 /// A map that cross references each local with the locations where it
 /// is defined (assigned), used, or dropped. Used during liveness
 /// computation.
diff --git a/src/librustc_mir/borrow_check/type_check/liveness/mod.rs b/src/librustc_mir/borrow_check/type_check/liveness/mod.rs
index 8f8e9af797963..ee3d89e741a54 100644
--- a/src/librustc_mir/borrow_check/type_check/liveness/mod.rs
+++ b/src/librustc_mir/borrow_check/type_check/liveness/mod.rs
@@ -1,17 +1,21 @@
-use crate::borrow_check::location::LocationTable;
-use crate::borrow_check::nll::constraints::OutlivesConstraintSet;
-use crate::borrow_check::nll::facts::{AllFacts, AllFactsExt};
-use crate::borrow_check::nll::region_infer::values::RegionValueElements;
-use crate::borrow_check::nll::universal_regions::UniversalRegions;
-use crate::borrow_check::nll::ToRegionVid;
-use crate::dataflow::move_paths::MoveData;
-use crate::dataflow::FlowAtLocation;
-use crate::dataflow::MaybeInitializedPlaces;
 use rustc::mir::{Body, Local, ReadOnlyBodyAndCache};
 use rustc::ty::{RegionVid, TyCtxt};
 use rustc_data_structures::fx::FxHashSet;
 use std::rc::Rc;
 
+use crate::dataflow::move_paths::MoveData;
+use crate::dataflow::FlowAtLocation;
+use crate::dataflow::MaybeInitializedPlaces;
+
+use crate::borrow_check::{
+    location::LocationTable,
+    constraints::OutlivesConstraintSet,
+    facts::{AllFacts, AllFactsExt},
+    region_infer::values::RegionValueElements,
+    universal_regions::UniversalRegions,
+    nll::ToRegionVid,
+};
+
 use super::TypeChecker;
 
 mod local_use_map;
diff --git a/src/librustc_mir/borrow_check/type_check/liveness/trace.rs b/src/librustc_mir/borrow_check/type_check/liveness/trace.rs
index ba6fd75eea59c..9afd25a0f7f7e 100644
--- a/src/librustc_mir/borrow_check/type_check/liveness/trace.rs
+++ b/src/librustc_mir/borrow_check/type_check/liveness/trace.rs
@@ -1,11 +1,3 @@
-use crate::borrow_check::nll::region_infer::values::{self, PointIndex, RegionValueElements};
-use crate::borrow_check::nll::type_check::liveness::local_use_map::LocalUseMap;
-use crate::borrow_check::nll::type_check::liveness::polonius;
-use crate::borrow_check::nll::type_check::NormalizeLocation;
-use crate::borrow_check::nll::type_check::TypeChecker;
-use crate::dataflow::indexes::MovePathIndex;
-use crate::dataflow::move_paths::MoveData;
-use crate::dataflow::{FlowAtLocation, FlowsAtLocation, MaybeInitializedPlaces};
 use rustc::infer::canonical::QueryRegionConstraints;
 use rustc::mir::{BasicBlock, ConstraintCategory, Local, Location, ReadOnlyBodyAndCache};
 use rustc::traits::query::dropck_outlives::DropckOutlivesResult;
@@ -16,6 +8,18 @@ use rustc_index::bit_set::HybridBitSet;
 use rustc_data_structures::fx::{FxHashMap, FxHashSet};
 use std::rc::Rc;
 
+use crate::dataflow::indexes::MovePathIndex;
+use crate::dataflow::move_paths::MoveData;
+use crate::dataflow::{FlowAtLocation, FlowsAtLocation, MaybeInitializedPlaces};
+
+use crate::borrow_check::{
+    region_infer::values::{self, PointIndex, RegionValueElements},
+    type_check::liveness::local_use_map::LocalUseMap,
+    type_check::liveness::polonius,
+    type_check::NormalizeLocation,
+    type_check::TypeChecker,
+};
+
 /// This is the heart of the liveness computation. For each variable X
 /// that requires a liveness computation, it walks over all the uses
 /// of X and does a reverse depth-first search ("trace") through the
diff --git a/src/librustc_mir/borrow_check/type_check/mod.rs b/src/librustc_mir/borrow_check/type_check/mod.rs
index 1e3723edc564f..5d801a77b25f3 100644
--- a/src/librustc_mir/borrow_check/type_check/mod.rs
+++ b/src/librustc_mir/borrow_check/type_check/mod.rs
@@ -55,9 +55,32 @@ use crate::dataflow::MaybeInitializedPlaces;
 use crate::dataflow::move_paths::MoveData;
 use crate::transform::promote_consts::should_suggest_const_in_array_repeat_expressions_attribute;
 
+use crate::transform::promote_consts::should_suggest_const_in_array_repeat_expressions_attribute;
+use crate::dataflow::move_paths::MoveData;
+use crate::dataflow::FlowAtLocation;
+use crate::dataflow::MaybeInitializedPlaces;
+
+use crate::borrow_check::{
+    borrow_set::BorrowSet,
+    location::LocationTable,
+    constraints::{OutlivesConstraintSet, OutlivesConstraint},
+    member_constraints::MemberConstraintSet,
+    facts::AllFacts,
+    region_infer::values::{
+        LivenessValues, PlaceholderIndex, PlaceholderIndices, RegionValueElements,
+    },
+    region_infer::{ClosureRegionRequirementsExt, TypeTest},
+    type_check::free_region_relations::{
+        CreateResult, UniversalRegionRelations,
+    },
+    universal_regions::{DefiningTy, UniversalRegions},
+    nll::ToRegionVid,
+    renumber,
+};
+
 macro_rules! span_mirbug {
     ($context:expr, $elem:expr, $($message:tt)*) => ({
-        $crate::borrow_check::nll::type_check::mirbug(
+        $crate::borrow_check::type_check::mirbug(
             $context.tcx(),
             $context.last_span,
             &format!(
diff --git a/src/librustc_mir/borrow_check/type_check/relate_tys.rs b/src/librustc_mir/borrow_check/type_check/relate_tys.rs
index 80bf0478128c7..80da8a82c51ed 100644
--- a/src/librustc_mir/borrow_check/type_check/relate_tys.rs
+++ b/src/librustc_mir/borrow_check/type_check/relate_tys.rs
@@ -1,5 +1,3 @@
-use crate::borrow_check::nll::constraints::OutlivesConstraint;
-use crate::borrow_check::nll::type_check::{BorrowCheckContext, Locations};
 use rustc::infer::nll_relate::{TypeRelating, TypeRelatingDelegate, NormalizationStrategy};
 use rustc::infer::{InferCtxt, NLLRegionVariableOrigin};
 use rustc::mir::ConstraintCategory;
@@ -8,6 +6,9 @@ use rustc::traits::DomainGoal;
 use rustc::ty::relate::TypeRelation;
 use rustc::ty::{self, Ty};
 
+use crate::borrow_check::constraints::OutlivesConstraint;
+use crate::borrow_check::type_check::{BorrowCheckContext, Locations};
+
 /// Adds sufficient constraints to ensure that `a R b` where `R` depends on `v`:
 ///
 /// - "Covariant" `a <: b`
diff --git a/src/librustc_mir/borrow_check/universal_regions.rs b/src/librustc_mir/borrow_check/universal_regions.rs
index 9ad15fca0017d..c0353039b680c 100644
--- a/src/librustc_mir/borrow_check/universal_regions.rs
+++ b/src/librustc_mir/borrow_check/universal_regions.rs
@@ -25,7 +25,7 @@ use rustc_index::vec::{Idx, IndexVec};
 use rustc_errors::DiagnosticBuilder;
 use std::iter;
 
-use super::ToRegionVid;
+use crate::borrow_check::nll::ToRegionVid;
 
 #[derive(Debug)]
 pub struct UniversalRegions<'tcx> {
diff --git a/src/librustc_mir/dataflow/impls/borrows.rs b/src/librustc_mir/dataflow/impls/borrows.rs
index 7e7652cdab5ce..d4f26c265e64c 100644
--- a/src/librustc_mir/dataflow/impls/borrows.rs
+++ b/src/librustc_mir/dataflow/impls/borrows.rs
@@ -1,6 +1,3 @@
-use crate::borrow_check::borrow_set::{BorrowSet, BorrowData};
-use crate::borrow_check::place_ext::PlaceExt;
-
 use rustc::mir::{self, Location, Place, PlaceBase, Body};
 use rustc::ty::{self, TyCtxt};
 use rustc::ty::RegionVid;
@@ -10,9 +7,14 @@ use rustc_data_structures::fx::FxHashMap;
 use rustc_index::vec::{Idx, IndexVec};
 
 use crate::dataflow::{BitDenotation, BottomValue, GenKillSet};
-use crate::borrow_check::nll::region_infer::RegionInferenceContext;
-use crate::borrow_check::nll::ToRegionVid;
-use crate::borrow_check::places_conflict;
+
+use crate::borrow_check::{
+    borrow_set::{BorrowSet, BorrowData},
+    place_ext::PlaceExt,
+    region_infer::RegionInferenceContext,
+    nll::ToRegionVid,
+    places_conflict,
+};
 
 use std::rc::Rc;
 

From cee2c28ee8c3afa34fdd6838f2956b8172a26abc Mon Sep 17 00:00:00 2001
From: Mark Mansi <markm@cs.wisc.edu>
Date: Fri, 29 Nov 2019 20:05:29 -0600
Subject: [PATCH 3/6] tidy

---
 .../borrow_check/type_check/free_region_relations.rs             | 1 -
 1 file changed, 1 deletion(-)

diff --git a/src/librustc_mir/borrow_check/type_check/free_region_relations.rs b/src/librustc_mir/borrow_check/type_check/free_region_relations.rs
index 8bbaeaace75b6..03a7f97ac51f1 100644
--- a/src/librustc_mir/borrow_check/type_check/free_region_relations.rs
+++ b/src/librustc_mir/borrow_check/type_check/free_region_relations.rs
@@ -1,4 +1,3 @@
-
 use rustc::infer::canonical::QueryRegionConstraints;
 use rustc::infer::outlives::free_region_map::FreeRegionRelations;
 use rustc::infer::region_constraints::GenericKind;

From 78ecf86291e1d89e8fe43e49c756bec196fb86a6 Mon Sep 17 00:00:00 2001
From: Mark Mansi <markm@cs.wisc.edu>
Date: Thu, 5 Dec 2019 12:00:40 -0600
Subject: [PATCH 4/6] fix imports

---
 .../borrow_check/type_check/mod.rs            | 21 -------------------
 1 file changed, 21 deletions(-)

diff --git a/src/librustc_mir/borrow_check/type_check/mod.rs b/src/librustc_mir/borrow_check/type_check/mod.rs
index 5d801a77b25f3..663536bc2b4b6 100644
--- a/src/librustc_mir/borrow_check/type_check/mod.rs
+++ b/src/librustc_mir/borrow_check/type_check/mod.rs
@@ -34,32 +34,11 @@ use rustc_error_codes::*;
 use rustc_index::vec::{Idx, IndexVec};
 use syntax_pos::{DUMMY_SP, Span};
 
-use crate::borrow_check::borrow_set::BorrowSet;
-use crate::borrow_check::location::LocationTable;
-use crate::borrow_check::nll::constraints::{OutlivesConstraint, OutlivesConstraintSet};
-use crate::borrow_check::nll::facts::AllFacts;
-use crate::borrow_check::nll::member_constraints::MemberConstraintSet;
-use crate::borrow_check::nll::region_infer::{ClosureRegionRequirementsExt, TypeTest};
-use crate::borrow_check::nll::region_infer::values::LivenessValues;
-use crate::borrow_check::nll::region_infer::values::PlaceholderIndex;
-use crate::borrow_check::nll::region_infer::values::PlaceholderIndices;
-use crate::borrow_check::nll::region_infer::values::RegionValueElements;
-use crate::borrow_check::nll::renumber;
-use crate::borrow_check::nll::ToRegionVid;
-use crate::borrow_check::nll::type_check::free_region_relations::{
-    CreateResult, UniversalRegionRelations,
-};
-use crate::borrow_check::nll::universal_regions::{DefiningTy, UniversalRegions};
 use crate::dataflow::FlowAtLocation;
 use crate::dataflow::MaybeInitializedPlaces;
 use crate::dataflow::move_paths::MoveData;
 use crate::transform::promote_consts::should_suggest_const_in_array_repeat_expressions_attribute;
 
-use crate::transform::promote_consts::should_suggest_const_in_array_repeat_expressions_attribute;
-use crate::dataflow::move_paths::MoveData;
-use crate::dataflow::FlowAtLocation;
-use crate::dataflow::MaybeInitializedPlaces;
-
 use crate::borrow_check::{
     borrow_set::BorrowSet,
     location::LocationTable,

From 02d93bd703b54112afccf4719497bcf9ab0979d0 Mon Sep 17 00:00:00 2001
From: Mark Mansi <markm@cs.wisc.edu>
Date: Fri, 6 Dec 2019 10:02:48 -0600
Subject: [PATCH 5/6] more private

---
 src/librustc_mir/borrow_check/mod.rs       | 25 ++++++++++++----------
 src/librustc_mir/dataflow/impls/borrows.rs | 12 ++++-------
 2 files changed, 18 insertions(+), 19 deletions(-)

diff --git a/src/librustc_mir/borrow_check/mod.rs b/src/librustc_mir/borrow_check/mod.rs
index fb26effc0bc96..11012ef2fc7ee 100644
--- a/src/librustc_mir/borrow_check/mod.rs
+++ b/src/librustc_mir/borrow_check/mod.rs
@@ -40,13 +40,11 @@ use crate::dataflow::{do_dataflow, DebugFormatted};
 use crate::dataflow::EverInitializedPlaces;
 use crate::dataflow::{MaybeInitializedPlaces, MaybeUninitializedPlaces};
 
-use self::borrow_set::{BorrowData, BorrowSet};
 use self::flows::Flows;
 use self::location::LocationTable;
 use self::prefixes::PrefixSet;
 use self::MutateMode::{JustWrite, WriteAndRead};
 use self::diagnostics::AccessKind;
-use self::region_infer::RegionInferenceContext;
 
 use self::path_utils::*;
 
@@ -61,15 +59,20 @@ mod facts;
 mod invalidation;
 mod renumber;
 mod member_constraints;
-
-crate mod constraints;
-crate mod universal_regions;
-crate mod type_check;
-crate mod region_infer;
-crate mod borrow_set;
-crate mod place_ext;
-crate mod places_conflict;
-crate mod nll;
+mod constraints;
+mod universal_regions;
+mod type_check;
+mod region_infer;
+mod borrow_set;
+mod place_ext;
+mod places_conflict;
+mod nll;
+
+crate use region_infer::RegionInferenceContext;
+crate use borrow_set::{BorrowSet, BorrowData};
+crate use places_conflict::{places_conflict, PlaceConflictBias};
+crate use place_ext::PlaceExt;
+crate use nll::ToRegionVid;
 
 // FIXME(eddyb) perhaps move this somewhere more centrally.
 #[derive(Debug)]
diff --git a/src/librustc_mir/dataflow/impls/borrows.rs b/src/librustc_mir/dataflow/impls/borrows.rs
index d4f26c265e64c..5433b7f5f74f7 100644
--- a/src/librustc_mir/dataflow/impls/borrows.rs
+++ b/src/librustc_mir/dataflow/impls/borrows.rs
@@ -6,15 +6,11 @@ use rustc_index::bit_set::BitSet;
 use rustc_data_structures::fx::FxHashMap;
 use rustc_index::vec::{Idx, IndexVec};
 
-use crate::dataflow::{BitDenotation, BottomValue, GenKillSet};
-
 use crate::borrow_check::{
-    borrow_set::{BorrowSet, BorrowData},
-    place_ext::PlaceExt,
-    region_infer::RegionInferenceContext,
-    nll::ToRegionVid,
+    ToRegionVid, BorrowSet, BorrowData, RegionInferenceContext, PlaceExt, PlaceConflictBias,
     places_conflict,
 };
+use crate::dataflow::{BitDenotation, BottomValue, GenKillSet};
 
 use std::rc::Rc;
 
@@ -223,13 +219,13 @@ impl<'a, 'tcx> Borrows<'a, 'tcx> {
             // locations.
             let definitely_conflicting_borrows = other_borrows_of_local
                 .filter(|&&i| {
-                    places_conflict::places_conflict(
+                    places_conflict(
                         self.tcx,
                         self.param_env,
                         self.body,
                         &self.borrow_set.borrows[i].borrowed_place,
                         place,
-                        places_conflict::PlaceConflictBias::NoOverlap)
+                        PlaceConflictBias::NoOverlap)
                 });
 
             trans.kill_all(definitely_conflicting_borrows);

From bc9582a9534f8d352581617780abe247aaddc2ae Mon Sep 17 00:00:00 2001
From: Mark Mansi <markm@cs.wisc.edu>
Date: Mon, 9 Dec 2019 12:24:47 -0600
Subject: [PATCH 6/6] fix imports after rebase

---
 src/librustc_mir/borrow_check/nll.rs | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/librustc_mir/borrow_check/nll.rs b/src/librustc_mir/borrow_check/nll.rs
index 61e6b4c863180..6d28a8caa92bd 100644
--- a/src/librustc_mir/borrow_check/nll.rs
+++ b/src/librustc_mir/borrow_check/nll.rs
@@ -22,15 +22,14 @@ use polonius_engine::{Algorithm, Output};
 
 use crate::util as mir_util;
 use crate::util::pretty;
-use crate::dataflow::indexes::BorrowIndex;
-use crate::dataflow::move_paths::{InitLocation, MoveData, MovePathIndex, InitKind};
+use crate::dataflow::move_paths::{InitLocation, MoveData, InitKind};
 use crate::dataflow::FlowAtLocation;
 use crate::dataflow::MaybeInitializedPlaces;
 use crate::transform::MirSource;
 
 use crate::borrow_check::{
     borrow_set::BorrowSet,
-    location::{LocationIndex, LocationTable},
+    location::LocationTable,
     facts::{AllFacts, AllFactsExt, RustcFacts},
     region_infer::{RegionInferenceContext, values::RegionValueElements},
     universal_regions::UniversalRegions,