Skip to content

Commit e9469a6

Browse files
committed
Auto merge of rust-lang#66886 - mark-i-m:simplify-borrow_check-2, r=matthewjasper
Remove the borrow check::nll submodule NLL is the only borrow checker now, so no need to have a separate submodule. @rustbot modify labels: +S-blocked Waiting on rust-lang#66815
2 parents 3eebe05 + bc9582a commit e9469a6

30 files changed

+182
-148
lines changed

src/librustc_mir/borrow_check/nll/constraint_generation.rs renamed to src/librustc_mir/borrow_check/constraint_generation.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
use crate::borrow_check::borrow_set::BorrowSet;
2-
use crate::borrow_check::location::LocationTable;
3-
use crate::borrow_check::nll::ToRegionVid;
4-
use crate::borrow_check::nll::facts::AllFacts;
5-
use crate::borrow_check::nll::region_infer::values::LivenessValues;
6-
use crate::borrow_check::places_conflict;
71
use rustc::infer::InferCtxt;
82
use rustc::mir::visit::TyContext;
93
use rustc::mir::visit::Visitor;
@@ -15,6 +9,15 @@ use rustc::ty::fold::TypeFoldable;
159
use rustc::ty::{self, RegionVid, Ty};
1610
use rustc::ty::subst::SubstsRef;
1711

12+
use crate::borrow_check::{
13+
borrow_set::BorrowSet,
14+
location::LocationTable,
15+
nll::ToRegionVid,
16+
facts::AllFacts,
17+
region_infer::values::LivenessValues,
18+
places_conflict,
19+
};
20+
1821
pub(super) fn generate_constraints<'cx, 'tcx>(
1922
infcx: &InferCtxt<'cx, 'tcx>,
2023
param_env: ty::ParamEnv<'tcx>,

src/librustc_mir/borrow_check/nll/constraints/graph.rs renamed to src/librustc_mir/borrow_check/constraints/graph.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
1-
use crate::borrow_check::nll::type_check::Locations;
2-
use crate::borrow_check::nll::constraints::OutlivesConstraintIndex;
3-
use crate::borrow_check::nll::constraints::{OutlivesConstraintSet, OutlivesConstraint};
41
use rustc::mir::ConstraintCategory;
52
use rustc::ty::RegionVid;
63
use rustc_data_structures::graph;
74
use rustc_index::vec::IndexVec;
85
use syntax_pos::DUMMY_SP;
96

7+
use crate::borrow_check::{
8+
type_check::Locations,
9+
constraints::OutlivesConstraintIndex,
10+
constraints::{OutlivesConstraintSet, OutlivesConstraint},
11+
};
12+
1013
/// The construct graph organizes the constraints by their end-points.
1114
/// It can be used to view a `R1: R2` constraint as either an edge `R1
1215
/// -> R2` or `R2 -> R1` depending on the direction type `D`.

src/librustc_mir/borrow_check/nll/constraints/mod.rs renamed to src/librustc_mir/borrow_check/constraints/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
use crate::borrow_check::nll::type_check::Locations;
21
use rustc::mir::ConstraintCategory;
32
use rustc::ty::RegionVid;
43
use rustc_data_structures::graph::scc::Sccs;
54
use rustc_index::vec::{Idx, IndexVec};
65
use std::fmt;
76
use std::ops::Index;
87

8+
use crate::borrow_check::type_check::Locations;
9+
910
crate mod graph;
1011

1112
/// A set of NLL region constraints. These include "outlives"

src/librustc_mir/borrow_check/diagnostics/explain_borrow.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1+
//! Print diagnostics to explain why values are borrowed.
2+
13
use std::collections::VecDeque;
24

3-
use crate::borrow_check::borrow_set::BorrowData;
4-
use crate::borrow_check::nll::region_infer::Cause;
5-
use crate::borrow_check::nll::ConstraintDescription;
6-
use crate::borrow_check::{MirBorrowckCtxt, WriteKind};
75
use rustc::mir::{
86
CastKind, ConstraintCategory, FakeReadCause, Local, Location, Body, Operand, Place, Rvalue,
97
Statement, StatementKind, TerminatorKind,
@@ -16,6 +14,13 @@ use rustc_errors::DiagnosticBuilder;
1614
use syntax_pos::Span;
1715
use syntax_pos::symbol::Symbol;
1816

17+
use crate::borrow_check::{
18+
borrow_set::BorrowData,
19+
region_infer::Cause,
20+
nll::ConstraintDescription,
21+
MirBorrowckCtxt, WriteKind,
22+
};
23+
1924
use super::{UseSpans, find_use, RegionName};
2025

2126
#[derive(Debug)]

src/librustc_mir/borrow_check/diagnostics/find_use.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
use std::collections::VecDeque;
22
use std::rc::Rc;
33

4-
use crate::borrow_check::nll::region_infer::{Cause, RegionInferenceContext};
5-
use crate::borrow_check::nll::ToRegionVid;
4+
use crate::borrow_check::{nll::ToRegionVid, region_infer::{Cause, RegionInferenceContext}};
65
use crate::util::liveness::{self, DefUse};
76
use rustc::mir::visit::{MirVisitable, PlaceContext, Visitor};
87
use rustc::mir::{Local, Location, Body};

src/librustc_mir/borrow_check/diagnostics/outlives_suggestion.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use syntax_pos::symbol::Symbol;
1313

1414
use smallvec::SmallVec;
1515

16-
use crate::borrow_check::nll::region_infer::RegionInferenceContext;
16+
use crate::borrow_check::region_infer::RegionInferenceContext;
1717

1818
use super::{
1919
RegionName, RegionNameSource, ErrorConstraintInfo, ErrorReportingCtx, RegionErrorNamingCtx,

src/librustc_mir/borrow_check/diagnostics/region_errors.rs

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
1-
use crate::borrow_check::nll::constraints::OutlivesConstraint;
2-
use crate::borrow_check::nll::region_infer::RegionInferenceContext;
3-
use crate::borrow_check::nll::type_check::Locations;
4-
use crate::borrow_check::nll::universal_regions::DefiningTy;
5-
use crate::borrow_check::nll::ConstraintDescription;
6-
use crate::borrow_check::Upvar;
7-
use crate::util::borrowck_errors;
1+
//! Error reporting machinery for lifetime errors.
2+
83
use rustc::hir::def_id::DefId;
94
use rustc::infer::error_reporting::nice_region_error::NiceRegionError;
105
use rustc::infer::InferCtxt;
@@ -19,6 +14,17 @@ use syntax::symbol::kw;
1914
use syntax_pos::Span;
2015
use syntax_pos::symbol::Symbol;
2116

17+
use crate::util::borrowck_errors;
18+
19+
use crate::borrow_check::{
20+
constraints::OutlivesConstraint,
21+
region_infer::RegionInferenceContext,
22+
type_check::Locations,
23+
universal_regions::DefiningTy,
24+
nll::ConstraintDescription,
25+
Upvar,
26+
};
27+
2228
use super::{OutlivesSuggestionBuilder, RegionName, RegionNameSource, RegionErrorNamingCtx};
2329

2430
impl ConstraintDescription for ConstraintCategory {

src/librustc_mir/borrow_check/diagnostics/region_name.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,13 @@ use rustc_data_structures::fx::FxHashMap;
1515
use syntax_pos::{Span, symbol::Symbol, DUMMY_SP};
1616

1717
use crate::borrow_check::{
18-
nll::region_infer::RegionInferenceContext,
19-
nll::universal_regions::DefiningTy,
18+
diagnostics::region_errors::ErrorReportingCtx,
19+
region_infer::RegionInferenceContext,
20+
universal_regions::DefiningTy,
2021
nll::ToRegionVid,
2122
Upvar,
2223
};
2324

24-
use super::region_errors::ErrorReportingCtx;
25-
2625
/// A name for a particular region used in emitting diagnostics. This name could be a generated
2726
/// name like `'1`, a name used by the user like `'a`, or a name like `'static`.
2827
#[derive(Debug, Clone)]

src/librustc_mir/borrow_check/diagnostics/var_name.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
use crate::borrow_check::nll::region_infer::RegionInferenceContext;
2-
use crate::borrow_check::nll::ToRegionVid;
1+
use crate::borrow_check::{nll::ToRegionVid, region_infer::RegionInferenceContext};
32
use crate::borrow_check::Upvar;
43
use rustc::mir::{Local, Body};
54
use rustc::ty::{RegionVid, TyCtxt};

0 commit comments

Comments
 (0)