Skip to content

Commit 3c4612a

Browse files
committed
fix some imports
1 parent f5ac04b commit 3c4612a

File tree

8 files changed

+93
-83
lines changed

8 files changed

+93
-83
lines changed

src/librustc_mir/borrow_check/diagnostics/conflict_errors.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,14 @@ use crate::dataflow::indexes::{MovePathIndex, MoveOutIndex};
1919
use crate::util::borrowck_errors;
2020

2121
use crate::borrow_check::{
22-
nll::region_infer::{RegionName, RegionNameSource},
2322
prefixes::IsPrefixOf,
2423
WriteKind,
2524
borrow_set::BorrowData,
2625
MirBorrowckCtxt, InitializationRequiringAction, PrefixSet
2726
};
2827

2928
use super::{
30-
IncludingDowncast, UseSpans,
29+
IncludingDowncast, UseSpans, RegionName, RegionNameSource,
3130
explain_borrow::BorrowExplanation,
3231
};
3332

src/librustc_mir/borrow_check/diagnostics/explain_borrow.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::collections::VecDeque;
22

33
use crate::borrow_check::borrow_set::BorrowData;
4-
use crate::borrow_check::nll::region_infer::{Cause, RegionName};
4+
use crate::borrow_check::nll::region_infer::Cause;
55
use crate::borrow_check::nll::ConstraintDescription;
66
use crate::borrow_check::{MirBorrowckCtxt, WriteKind};
77
use rustc::mir::{
@@ -16,7 +16,7 @@ use rustc_errors::DiagnosticBuilder;
1616
use syntax_pos::Span;
1717
use syntax_pos::symbol::Symbol;
1818

19-
use super::{UseSpans, find_use};
19+
use super::{UseSpans, find_use, RegionName};
2020

2121
#[derive(Debug)]
2222
pub(in crate::borrow_check) enum BorrowExplanation {

src/librustc_mir/borrow_check/diagnostics/mod.rs

+8
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,20 @@ use super::MirBorrowckCtxt;
2020
use crate::dataflow::move_paths::{InitLocation, LookupResult};
2121

2222
mod find_use;
23+
mod var_name;
24+
mod region_name;
25+
mod outlives_suggestion;
2326

2427
crate mod conflict_errors;
2528
crate mod move_errors;
2629
crate mod mutability_errors;
30+
crate mod region_errors;
2731
crate mod explain_borrow;
2832

33+
crate use region_name::{RegionName, RegionNameSource, RegionErrorNamingCtx};
34+
crate use region_errors::{ErrorReportingCtx, ErrorConstraintInfo};
35+
crate use outlives_suggestion::OutlivesSuggestionBuilder;
36+
2937
pub(super) struct IncludingDowncast(pub(super) bool);
3038

3139
impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {

src/librustc_mir/borrow_check/diagnostics/outlives_suggestion.rs

+4-6
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,10 @@ use syntax_pos::symbol::Symbol;
1313

1414
use smallvec::SmallVec;
1515

16-
use crate::borrow_check::nll::region_infer::{
17-
error_reporting::{
18-
region_name::{RegionName, RegionNameSource},
19-
ErrorConstraintInfo, ErrorReportingCtx, RegionErrorNamingCtx,
20-
},
21-
RegionInferenceContext,
16+
use crate::borrow_check::nll::region_infer::RegionInferenceContext;
17+
18+
use super::{
19+
RegionName, RegionNameSource, ErrorConstraintInfo, ErrorReportingCtx, RegionErrorNamingCtx,
2220
};
2321

2422
/// The different things we could suggest.

src/librustc_mir/borrow_check/diagnostics/region_errors.rs

+13-20
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,7 @@ use syntax::symbol::kw;
1919
use syntax_pos::Span;
2020
use syntax_pos::symbol::Symbol;
2121

22-
use self::outlives_suggestion::OutlivesSuggestionBuilder;
23-
24-
pub mod outlives_suggestion;
25-
26-
mod region_name;
27-
mod var_name;
28-
29-
crate use self::region_name::{RegionName, RegionNameSource, RegionErrorNamingCtx};
22+
use super::{OutlivesSuggestionBuilder, RegionName, RegionNameSource, RegionErrorNamingCtx};
3023

3124
impl ConstraintDescription for ConstraintCategory {
3225
fn description(&self) -> &'static str {
@@ -61,36 +54,36 @@ enum Trace {
6154
/// Various pieces of state used when reporting borrow checker errors.
6255
pub struct ErrorReportingCtx<'a, 'b, 'tcx> {
6356
/// The region inference context used for borrow chekcing this MIR body.
64-
region_infcx: &'b RegionInferenceContext<'tcx>,
57+
pub(super) region_infcx: &'b RegionInferenceContext<'tcx>,
6558

6659
/// The inference context used for type checking.
67-
infcx: &'b InferCtxt<'a, 'tcx>,
60+
pub(super) infcx: &'b InferCtxt<'a, 'tcx>,
6861

6962
/// The MIR def we are reporting errors on.
70-
mir_def_id: DefId,
63+
pub(super) mir_def_id: DefId,
7164

7265
/// The MIR body we are reporting errors on (for convenience).
73-
body: &'b Body<'tcx>,
66+
pub(super) body: &'b Body<'tcx>,
7467

7568
/// User variable names for MIR locals (where applicable).
7669
local_names: &'b IndexVec<Local, Option<Symbol>>,
7770

7871
/// Any upvars for the MIR body we have kept track of during borrow checking.
79-
upvars: &'b [Upvar],
72+
pub(super) upvars: &'b [Upvar],
8073
}
8174

8275
/// Information about the various region constraints involved in a borrow checker error.
8376
#[derive(Clone, Debug)]
8477
pub struct ErrorConstraintInfo {
8578
// fr: outlived_fr
86-
fr: RegionVid,
87-
fr_is_local: bool,
88-
outlived_fr: RegionVid,
89-
outlived_fr_is_local: bool,
79+
pub(super) fr: RegionVid,
80+
pub(super) fr_is_local: bool,
81+
pub(super) outlived_fr: RegionVid,
82+
pub(super) outlived_fr_is_local: bool,
9083

9184
// Category and span for best blame constraint
92-
category: ConstraintCategory,
93-
span: Span,
85+
pub(super) category: ConstraintCategory,
86+
pub(super) span: Span,
9487
}
9588

9689
impl<'tcx> RegionInferenceContext<'tcx> {
@@ -368,7 +361,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
368361
/// ```
369362
///
370363
/// Here we would be invoked with `fr = 'a` and `outlived_fr = `'b`.
371-
pub(super) fn report_error<'a>(
364+
pub(in crate::borrow_check) fn report_error<'a>(
372365
&'a self,
373366
body: &Body<'tcx>,
374367
local_names: &IndexVec<Local, Option<Symbol>>,

src/librustc_mir/borrow_check/diagnostics/region_name.rs

+9-7
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,5 @@
11
use std::fmt::{self, Display};
22

3-
use crate::borrow_check::nll::region_infer::{
4-
RegionInferenceContext,
5-
error_reporting::ErrorReportingCtx,
6-
};
7-
use crate::borrow_check::nll::universal_regions::DefiningTy;
8-
use crate::borrow_check::nll::ToRegionVid;
9-
use crate::borrow_check::Upvar;
103
use rustc::hir;
114
use rustc::hir::def::{Res, DefKind};
125
use rustc::hir::def_id::DefId;
@@ -21,6 +14,15 @@ use syntax::symbol::kw;
2114
use rustc_data_structures::fx::FxHashMap;
2215
use syntax_pos::{Span, symbol::Symbol, DUMMY_SP};
2316

17+
use crate::borrow_check::{
18+
nll::region_infer::RegionInferenceContext,
19+
nll::universal_regions::DefiningTy,
20+
nll::ToRegionVid,
21+
Upvar,
22+
};
23+
24+
use super::region_errors::ErrorReportingCtx;
25+
2426
/// A name for a particular region used in emitting diagnostics. This name could be a generated
2527
/// name like `'1`, a name used by the user like `'a`, or a name like `'static`.
2628
#[derive(Debug, Clone)]

src/librustc_mir/borrow_check/nll/mod.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,15 @@ use crate::util::pretty;
3434
mod constraint_generation;
3535
mod facts;
3636
mod invalidation;
37-
crate mod region_infer;
3837
mod renumber;
39-
crate mod type_check;
40-
mod universal_regions;
4138

42-
mod constraints;
4339
mod member_constraints;
4440

41+
crate mod constraints;
42+
crate mod universal_regions;
43+
crate mod type_check;
44+
crate mod region_infer;
45+
4546
use self::facts::AllFacts;
4647
use self::region_infer::RegionInferenceContext;
4748
use self::universal_regions::UniversalRegions;

0 commit comments

Comments
 (0)