Skip to content

Commit 9709b73

Browse files
committed
pub(crate) -> crate
The borrow checker code is already using `crate` extensively, so prefer being consistent with it.
1 parent abfd4d1 commit 9709b73

File tree

2 files changed

+27
-27
lines changed

2 files changed

+27
-27
lines changed

Diff for: src/librustc_mir/borrow_check/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -421,8 +421,8 @@ fn downgrade_if_error(diag: &mut Diagnostic) {
421421
}
422422
}
423423

424-
pub struct MirBorrowckCtxt<'cx, 'tcx> {
425-
pub(crate) infcx: &'cx InferCtxt<'cx, 'tcx>,
424+
crate struct MirBorrowckCtxt<'cx, 'tcx> {
425+
crate infcx: &'cx InferCtxt<'cx, 'tcx>,
426426
body: &'cx Body<'tcx>,
427427
mir_def_id: DefId,
428428
move_data: &'cx MoveData<'tcx>,

Diff for: src/librustc_mir/util/borrowck_errors.rs

+25-25
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use rustc_errors::{DiagnosticBuilder, DiagnosticId};
33
use syntax_pos::{MultiSpan, Span};
44

55
impl<'cx, 'tcx> crate::borrow_check::MirBorrowckCtxt<'cx, 'tcx> {
6-
pub(crate) fn cannot_move_when_borrowed(
6+
crate fn cannot_move_when_borrowed(
77
&self,
88
span: Span,
99
desc: &str,
@@ -17,7 +17,7 @@ impl<'cx, 'tcx> crate::borrow_check::MirBorrowckCtxt<'cx, 'tcx> {
1717
)
1818
}
1919

20-
pub(crate) fn cannot_use_when_mutably_borrowed(
20+
crate fn cannot_use_when_mutably_borrowed(
2121
&self,
2222
span: Span,
2323
desc: &str,
@@ -40,7 +40,7 @@ impl<'cx, 'tcx> crate::borrow_check::MirBorrowckCtxt<'cx, 'tcx> {
4040
err
4141
}
4242

43-
pub(crate) fn cannot_act_on_uninitialized_variable(
43+
crate fn cannot_act_on_uninitialized_variable(
4444
&self,
4545
span: Span,
4646
verb: &str,
@@ -56,7 +56,7 @@ impl<'cx, 'tcx> crate::borrow_check::MirBorrowckCtxt<'cx, 'tcx> {
5656
)
5757
}
5858

59-
pub(crate) fn cannot_mutably_borrow_multiply(
59+
crate fn cannot_mutably_borrow_multiply(
6060
&self,
6161
new_loan_span: Span,
6262
desc: &str,
@@ -105,7 +105,7 @@ impl<'cx, 'tcx> crate::borrow_check::MirBorrowckCtxt<'cx, 'tcx> {
105105
err
106106
}
107107

108-
pub(crate) fn cannot_uniquely_borrow_by_two_closures(
108+
crate fn cannot_uniquely_borrow_by_two_closures(
109109
&self,
110110
new_loan_span: Span,
111111
desc: &str,
@@ -134,7 +134,7 @@ impl<'cx, 'tcx> crate::borrow_check::MirBorrowckCtxt<'cx, 'tcx> {
134134
err
135135
}
136136

137-
pub(crate) fn cannot_uniquely_borrow_by_one_closure(
137+
crate fn cannot_uniquely_borrow_by_one_closure(
138138
&self,
139139
new_loan_span: Span,
140140
container_name: &str,
@@ -165,7 +165,7 @@ impl<'cx, 'tcx> crate::borrow_check::MirBorrowckCtxt<'cx, 'tcx> {
165165
err
166166
}
167167

168-
pub(crate) fn cannot_reborrow_already_uniquely_borrowed(
168+
crate fn cannot_reborrow_already_uniquely_borrowed(
169169
&self,
170170
new_loan_span: Span,
171171
container_name: &str,
@@ -201,7 +201,7 @@ impl<'cx, 'tcx> crate::borrow_check::MirBorrowckCtxt<'cx, 'tcx> {
201201
err
202202
}
203203

204-
pub(crate) fn cannot_reborrow_already_borrowed(
204+
crate fn cannot_reborrow_already_borrowed(
205205
&self,
206206
span: Span,
207207
desc_new: &str,
@@ -254,7 +254,7 @@ impl<'cx, 'tcx> crate::borrow_check::MirBorrowckCtxt<'cx, 'tcx> {
254254
err
255255
}
256256

257-
pub(crate) fn cannot_assign_to_borrowed(
257+
crate fn cannot_assign_to_borrowed(
258258
&self,
259259
span: Span,
260260
borrow_span: Span,
@@ -276,7 +276,7 @@ impl<'cx, 'tcx> crate::borrow_check::MirBorrowckCtxt<'cx, 'tcx> {
276276
err
277277
}
278278

279-
pub(crate) fn cannot_reassign_immutable(
279+
crate fn cannot_reassign_immutable(
280280
&self,
281281
span: Span,
282282
desc: &str,
@@ -297,11 +297,11 @@ impl<'cx, 'tcx> crate::borrow_check::MirBorrowckCtxt<'cx, 'tcx> {
297297
)
298298
}
299299

300-
pub(crate) fn cannot_assign(&self, span: Span, desc: &str) -> DiagnosticBuilder<'cx> {
300+
crate fn cannot_assign(&self, span: Span, desc: &str) -> DiagnosticBuilder<'cx> {
301301
struct_span_err!(self, span, E0594, "cannot assign to {}", desc)
302302
}
303303

304-
pub(crate) fn cannot_move_out_of(
304+
crate fn cannot_move_out_of(
305305
&self,
306306
move_from_span: Span,
307307
move_from_desc: &str,
@@ -318,7 +318,7 @@ impl<'cx, 'tcx> crate::borrow_check::MirBorrowckCtxt<'cx, 'tcx> {
318318
/// Signal an error due to an attempt to move out of the interior
319319
/// of an array or slice. `is_index` is None when error origin
320320
/// didn't capture whether there was an indexing operation or not.
321-
pub(crate) fn cannot_move_out_of_interior_noncopy(
321+
crate fn cannot_move_out_of_interior_noncopy(
322322
&self,
323323
move_from_span: Span,
324324
ty: Ty<'_>,
@@ -341,7 +341,7 @@ impl<'cx, 'tcx> crate::borrow_check::MirBorrowckCtxt<'cx, 'tcx> {
341341
err
342342
}
343343

344-
pub(crate) fn cannot_move_out_of_interior_of_drop(
344+
crate fn cannot_move_out_of_interior_of_drop(
345345
&self,
346346
move_from_span: Span,
347347
container_ty: Ty<'_>,
@@ -357,7 +357,7 @@ impl<'cx, 'tcx> crate::borrow_check::MirBorrowckCtxt<'cx, 'tcx> {
357357
err
358358
}
359359

360-
pub(crate) fn cannot_act_on_moved_value(
360+
crate fn cannot_act_on_moved_value(
361361
&self,
362362
use_span: Span,
363363
verb: &str,
@@ -379,7 +379,7 @@ impl<'cx, 'tcx> crate::borrow_check::MirBorrowckCtxt<'cx, 'tcx> {
379379
)
380380
}
381381

382-
pub(crate) fn cannot_borrow_path_as_mutable_because(
382+
crate fn cannot_borrow_path_as_mutable_because(
383383
&self,
384384
span: Span,
385385
path: &str,
@@ -395,7 +395,7 @@ impl<'cx, 'tcx> crate::borrow_check::MirBorrowckCtxt<'cx, 'tcx> {
395395
)
396396
}
397397

398-
pub(crate) fn cannot_mutate_in_match_guard(
398+
crate fn cannot_mutate_in_match_guard(
399399
&self,
400400
mutate_span: Span,
401401
match_span: Span,
@@ -415,7 +415,7 @@ impl<'cx, 'tcx> crate::borrow_check::MirBorrowckCtxt<'cx, 'tcx> {
415415
err
416416
}
417417

418-
pub(crate) fn cannot_borrow_across_generator_yield(
418+
crate fn cannot_borrow_across_generator_yield(
419419
&self,
420420
span: Span,
421421
yield_span: Span,
@@ -430,7 +430,7 @@ impl<'cx, 'tcx> crate::borrow_check::MirBorrowckCtxt<'cx, 'tcx> {
430430
err
431431
}
432432

433-
pub(crate) fn cannot_borrow_across_destructor(
433+
crate fn cannot_borrow_across_destructor(
434434
&self,
435435
borrow_span: Span,
436436
) -> DiagnosticBuilder<'cx> {
@@ -442,7 +442,7 @@ impl<'cx, 'tcx> crate::borrow_check::MirBorrowckCtxt<'cx, 'tcx> {
442442
)
443443
}
444444

445-
pub(crate) fn path_does_not_live_long_enough(
445+
crate fn path_does_not_live_long_enough(
446446
&self,
447447
span: Span,
448448
path: &str,
@@ -456,7 +456,7 @@ impl<'cx, 'tcx> crate::borrow_check::MirBorrowckCtxt<'cx, 'tcx> {
456456
)
457457
}
458458

459-
pub(crate) fn cannot_return_reference_to_local(
459+
crate fn cannot_return_reference_to_local(
460460
&self,
461461
span: Span,
462462
return_kind: &str,
@@ -481,7 +481,7 @@ impl<'cx, 'tcx> crate::borrow_check::MirBorrowckCtxt<'cx, 'tcx> {
481481
err
482482
}
483483

484-
pub(crate) fn cannot_capture_in_long_lived_closure(
484+
crate fn cannot_capture_in_long_lived_closure(
485485
&self,
486486
closure_span: Span,
487487
borrowed_path: &str,
@@ -504,7 +504,7 @@ impl<'cx, 'tcx> crate::borrow_check::MirBorrowckCtxt<'cx, 'tcx> {
504504
err
505505
}
506506

507-
pub(crate) fn thread_local_value_does_not_live_long_enough(
507+
crate fn thread_local_value_does_not_live_long_enough(
508508
&self,
509509
span: Span,
510510
) -> DiagnosticBuilder<'cx> {
@@ -516,7 +516,7 @@ impl<'cx, 'tcx> crate::borrow_check::MirBorrowckCtxt<'cx, 'tcx> {
516516
)
517517
}
518518

519-
pub(crate) fn temporary_value_borrowed_for_too_long(
519+
crate fn temporary_value_borrowed_for_too_long(
520520
&self,
521521
span: Span,
522522
) -> DiagnosticBuilder<'cx> {
@@ -538,7 +538,7 @@ impl<'cx, 'tcx> crate::borrow_check::MirBorrowckCtxt<'cx, 'tcx> {
538538
}
539539
}
540540

541-
pub(crate) fn borrowed_data_escapes_closure<'tcx>(
541+
crate fn borrowed_data_escapes_closure<'tcx>(
542542
tcx: TyCtxt<'tcx>,
543543
escape_span: Span,
544544
escapes_from: &str,

0 commit comments

Comments
 (0)