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