Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit e9e190a

Browse files
committedNov 26, 2022
removal boolize on container_name
1 parent 19d230b commit e9e190a

File tree

4 files changed

+9
-17
lines changed

4 files changed

+9
-17
lines changed
 

‎compiler/rustc_borrowck/src/borrowck_errors.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
104104
pub(crate) fn cannot_uniquely_borrow_by_one_closure(
105105
&self,
106106
new_loan_span: Span,
107-
is_generator: bool,
107+
container_name: &str,
108108
desc_new: &str,
109109
opt_via: &str,
110110
old_loan_span: Span,
@@ -114,7 +114,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
114114
) -> DiagnosticBuilder<'cx, ErrorGuaranteed> {
115115
self.infcx.tcx.sess.create_err(crate::session_diagnostics::ClosureUniquelyBorrowErr {
116116
new_loan_span,
117-
is_generator,
117+
container_name,
118118
desc_new,
119119
opt_via,
120120
old_loan_span,
@@ -127,7 +127,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
127127
pub(crate) fn cannot_reborrow_already_uniquely_borrowed(
128128
&self,
129129
new_loan_span: Span,
130-
is_generator: &str,
130+
container_name: &str,
131131
desc_new: &str,
132132
opt_via: &str,
133133
kind_new: &str,
@@ -138,7 +138,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
138138
) -> DiagnosticBuilder<'cx, ErrorGuaranteed> {
139139
self.infcx.tcx.sess.create_err(crate::session_diagnostics::ClosureReBorrowErr {
140140
new_loan_span,
141-
is_generator,
141+
container_name,
142142
desc_new,
143143
opt_via,
144144
kind_new,

‎compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -923,13 +923,11 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
923923
let borrow_spans = self.borrow_spans(span, location);
924924
let span = borrow_spans.args_or_use();
925925

926-
//FIXME: depercate when done diag migration
927926
let container_name = if issued_spans.for_generator() || borrow_spans.for_generator() {
928927
"generator"
929928
} else {
930929
"closure"
931930
};
932-
let is_generator = issued_spans.for_generator() || borrow_spans.for_generator();
933931

934932
let (desc_place, msg_place, msg_borrow, union_type_name) =
935933
self.describe_place_for_conflicting_borrow(place, issued_borrow.borrowed_place);
@@ -1044,7 +1042,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
10441042
first_borrow_desc = "first ";
10451043
self.cannot_uniquely_borrow_by_one_closure(
10461044
span,
1047-
is_generator,
1045+
container_name,
10481046
&desc_place,
10491047
"",
10501048
issued_span,

‎compiler/rustc_borrowck/src/session_diagnostics.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -756,7 +756,7 @@ pub(crate) struct ClosureUniquelyBorrowErr<'a> {
756756
#[primary_span]
757757
#[label]
758758
pub new_loan_span: Span,
759-
pub is_generator: bool,
759+
pub container_name: &'a str,
760760
pub desc_new: &'a str,
761761
pub opt_via: &'a str,
762762
#[label(occurs_label)]
@@ -773,7 +773,7 @@ pub(crate) struct ClosureReBorrowErr<'a> {
773773
#[primary_span]
774774
#[label]
775775
pub new_loan_span: Span,
776-
pub is_generator: &'a str,
776+
pub container_name: &'a str,
777777
pub desc_new: &'a str,
778778
pub opt_via: &'a str,
779779
pub kind_new: &'a str,

‎compiler/rustc_error_messages/locales/en-US/borrowck.ftl

+2-8
Original file line numberDiff line numberDiff line change
@@ -465,18 +465,12 @@ borrowck_cannot_mutably_borrow_multiply =
465465
466466
borrowck_cannot_uniquely_borrow_by_one_closure =
467467
closure requires unique access to {$desc_new} but {$noun_old} is already borrowed{$old_opt_via}
468-
.label = {$is_generator ->
469-
[true] generator
470-
*[false] closure
471-
} construction occurs here{$opt_via}
468+
.label = {$container_name} construction occurs here{$opt_via}
472469
.occurs_label = borrow occurs here{$old_opt_via}
473470
.ends_label = borrow ends here
474471
475472
borrowck_cannot_reborrow_already_uniquely_borrowed =
476473
cannot borrow {$desc_new}{$opt_via} as {$kind_new} because previous closure requires unique access
477474
.label = {$second_borrow_desc}borrow occurs here{$opt_via}
478-
.occurs_label = {$is_generator ->
479-
[true] generator
480-
*[false] closure
481-
} construction occurs here{$old_opt_via}
475+
.occurs_label = {$container_name} construction occurs here{$old_opt_via}
482476
.ends_label = borrow from closure ends here

0 commit comments

Comments
 (0)
Please sign in to comment.