@@ -14,18 +14,22 @@ use rustc_errors::{Applicability, DiagnosticBuilder};
14
14
use syntax_pos:: Span ;
15
15
use syntax:: source_map:: DesugaringKind ;
16
16
17
- use super :: nll:: explain_borrow:: BorrowExplanation ;
18
- use super :: nll:: region_infer:: { RegionName , RegionNameSource } ;
19
- use super :: prefixes:: IsPrefixOf ;
20
- use super :: WriteKind ;
21
- use super :: borrow_set:: BorrowData ;
22
- use super :: MirBorrowckCtxt ;
23
- use super :: { InitializationRequiringAction , PrefixSet } ;
24
- use super :: error_reporting:: { IncludingDowncast , UseSpans } ;
25
17
use crate :: dataflow:: drop_flag_effects;
26
18
use crate :: dataflow:: indexes:: { MovePathIndex , MoveOutIndex } ;
27
19
use crate :: util:: borrowck_errors;
28
20
21
+ use crate :: borrow_check:: {
22
+ prefixes:: IsPrefixOf ,
23
+ WriteKind ,
24
+ borrow_set:: BorrowData ,
25
+ MirBorrowckCtxt , InitializationRequiringAction , PrefixSet
26
+ } ;
27
+
28
+ use super :: {
29
+ IncludingDowncast , UseSpans , RegionName , RegionNameSource ,
30
+ explain_borrow:: BorrowExplanation ,
31
+ } ;
32
+
29
33
#[ derive( Debug ) ]
30
34
struct MoveSite {
31
35
/// Index of the "move out" that we found. The `MoveData` can
@@ -46,7 +50,7 @@ enum StorageDeadOrDrop<'tcx> {
46
50
}
47
51
48
52
impl < ' cx , ' tcx > MirBorrowckCtxt < ' cx , ' tcx > {
49
- pub ( super ) fn report_use_of_moved_or_uninitialized (
53
+ pub ( in crate :: borrow_check ) fn report_use_of_moved_or_uninitialized (
50
54
& mut self ,
51
55
location : Location ,
52
56
desired_action : InitializationRequiringAction ,
@@ -269,7 +273,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
269
273
}
270
274
}
271
275
272
- pub ( super ) fn report_move_out_while_borrowed (
276
+ pub ( in crate :: borrow_check ) fn report_move_out_while_borrowed (
273
277
& mut self ,
274
278
location : Location ,
275
279
( place, span) : ( & Place < ' tcx > , Span ) ,
@@ -326,7 +330,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
326
330
err. buffer ( & mut self . errors_buffer ) ;
327
331
}
328
332
329
- pub ( super ) fn report_use_while_mutably_borrowed (
333
+ pub ( in crate :: borrow_check ) fn report_use_while_mutably_borrowed (
330
334
& mut self ,
331
335
location : Location ,
332
336
( place, _span) : ( & Place < ' tcx > , Span ) ,
@@ -368,7 +372,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
368
372
err
369
373
}
370
374
371
- pub ( super ) fn report_conflicting_borrow (
375
+ pub ( in crate :: borrow_check ) fn report_conflicting_borrow (
372
376
& mut self ,
373
377
location : Location ,
374
378
( place, span) : ( & Place < ' tcx > , Span ) ,
@@ -614,7 +618,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
614
618
///
615
619
/// > cannot borrow `a.u` (via `a.u.z.c`) as immutable because it is also borrowed as
616
620
/// > mutable (via `a.u.s.b`) [E0502]
617
- pub ( super ) fn describe_place_for_conflicting_borrow (
621
+ pub ( in crate :: borrow_check ) fn describe_place_for_conflicting_borrow (
618
622
& self ,
619
623
first_borrowed_place : & Place < ' tcx > ,
620
624
second_borrowed_place : & Place < ' tcx > ,
@@ -722,7 +726,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
722
726
/// short a lifetime. (But sometimes it is more useful to report
723
727
/// it as a more direct conflict between the execution of a
724
728
/// `Drop::drop` with an aliasing borrow.)
725
- pub ( super ) fn report_borrowed_value_does_not_live_long_enough (
729
+ pub ( in crate :: borrow_check ) fn report_borrowed_value_does_not_live_long_enough (
726
730
& mut self ,
727
731
location : Location ,
728
732
borrow : & BorrowData < ' tcx > ,
@@ -1478,7 +1482,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
1478
1482
result
1479
1483
}
1480
1484
1481
- pub ( super ) fn report_illegal_mutation_of_borrowed (
1485
+ pub ( in crate :: borrow_check ) fn report_illegal_mutation_of_borrowed (
1482
1486
& mut self ,
1483
1487
location : Location ,
1484
1488
( place, span) : ( & Place < ' tcx > , Span ) ,
@@ -1537,7 +1541,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
1537
1541
/// assigned; `err_place` is a place providing a reason why
1538
1542
/// `place` is not mutable (e.g., the non-`mut` local `x` in an
1539
1543
/// assignment to `x.f`).
1540
- pub ( super ) fn report_illegal_reassignment (
1544
+ pub ( in crate :: borrow_check ) fn report_illegal_reassignment (
1541
1545
& mut self ,
1542
1546
_location : Location ,
1543
1547
( place, span) : ( & Place < ' tcx > , Span ) ,
@@ -2080,7 +2084,7 @@ enum AnnotatedBorrowFnSignature<'tcx> {
2080
2084
impl < ' tcx > AnnotatedBorrowFnSignature < ' tcx > {
2081
2085
/// Annotate the provided diagnostic with information about borrow from the fn signature that
2082
2086
/// helps explain.
2083
- pub ( super ) fn emit (
2087
+ pub ( in crate :: borrow_check ) fn emit (
2084
2088
& self ,
2085
2089
cx : & mut MirBorrowckCtxt < ' _ , ' tcx > ,
2086
2090
diag : & mut DiagnosticBuilder < ' _ > ,
0 commit comments