Skip to content

Commit ba198af

Browse files
committed
Rename 'cx to 'infcx
1 parent 86c8eae commit ba198af

File tree

10 files changed

+93
-93
lines changed

10 files changed

+93
-93
lines changed

compiler/rustc_borrowck/src/borrowck_errors.rs

+25-25
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ use rustc_middle::span_bug;
66
use rustc_middle::ty::{self, Ty, TyCtxt};
77
use rustc_span::Span;
88

9-
impl<'cx, 'tcx> crate::MirBorrowckCtxt<'_, '_, 'cx, 'tcx> {
10-
pub fn dcx(&self) -> DiagCtxtHandle<'cx> {
9+
impl<'infcx, 'tcx> crate::MirBorrowckCtxt<'_, '_, 'infcx, 'tcx> {
10+
pub fn dcx(&self) -> DiagCtxtHandle<'infcx> {
1111
self.infcx.dcx()
1212
}
1313

@@ -18,7 +18,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'_, '_, 'cx, 'tcx> {
1818
place: &str,
1919
borrow_place: &str,
2020
value_place: &str,
21-
) -> Diag<'cx> {
21+
) -> Diag<'infcx> {
2222
self.dcx().create_err(crate::session_diagnostics::MoveBorrow {
2323
place,
2424
span,
@@ -34,7 +34,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'_, '_, 'cx, 'tcx> {
3434
desc: &str,
3535
borrow_span: Span,
3636
borrow_desc: &str,
37-
) -> Diag<'cx> {
37+
) -> Diag<'infcx> {
3838
struct_span_code_err!(
3939
self.dcx(),
4040
span,
@@ -54,7 +54,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'_, '_, 'cx, 'tcx> {
5454
old_loan_span: Span,
5555
old_opt_via: &str,
5656
old_load_end_span: Option<Span>,
57-
) -> Diag<'cx> {
57+
) -> Diag<'infcx> {
5858
let via = |msg: &str| if msg.is_empty() { "".to_string() } else { format!(" (via {msg})") };
5959
let mut err = struct_span_code_err!(
6060
self.dcx(),
@@ -101,7 +101,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'_, '_, 'cx, 'tcx> {
101101
desc: &str,
102102
old_loan_span: Span,
103103
old_load_end_span: Option<Span>,
104-
) -> Diag<'cx> {
104+
) -> Diag<'infcx> {
105105
let mut err = struct_span_code_err!(
106106
self.dcx(),
107107
new_loan_span,
@@ -134,7 +134,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'_, '_, 'cx, 'tcx> {
134134
noun_old: &str,
135135
old_opt_via: &str,
136136
previous_end_span: Option<Span>,
137-
) -> Diag<'cx> {
137+
) -> Diag<'infcx> {
138138
let mut err = struct_span_code_err!(
139139
self.dcx(),
140140
new_loan_span,
@@ -166,7 +166,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'_, '_, 'cx, 'tcx> {
166166
old_opt_via: &str,
167167
previous_end_span: Option<Span>,
168168
second_borrow_desc: &str,
169-
) -> Diag<'cx> {
169+
) -> Diag<'infcx> {
170170
let mut err = struct_span_code_err!(
171171
self.dcx(),
172172
new_loan_span,
@@ -198,7 +198,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'_, '_, 'cx, 'tcx> {
198198
kind_old: &str,
199199
msg_old: &str,
200200
old_load_end_span: Option<Span>,
201-
) -> Diag<'cx> {
201+
) -> Diag<'infcx> {
202202
let via = |msg: &str| if msg.is_empty() { "".to_string() } else { format!(" (via {msg})") };
203203
let mut err = struct_span_code_err!(
204204
self.dcx(),
@@ -239,7 +239,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'_, '_, 'cx, 'tcx> {
239239
span: Span,
240240
borrow_span: Span,
241241
desc: &str,
242-
) -> Diag<'cx> {
242+
) -> Diag<'infcx> {
243243
struct_span_code_err!(
244244
self.dcx(),
245245
span,
@@ -256,20 +256,20 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'_, '_, 'cx, 'tcx> {
256256
span: Span,
257257
desc: &str,
258258
is_arg: bool,
259-
) -> Diag<'cx> {
259+
) -> Diag<'infcx> {
260260
let msg = if is_arg { "to immutable argument" } else { "twice to immutable variable" };
261261
struct_span_code_err!(self.dcx(), span, E0384, "cannot assign {} {}", msg, desc)
262262
}
263263

264-
pub(crate) fn cannot_assign(&self, span: Span, desc: &str) -> Diag<'cx> {
264+
pub(crate) fn cannot_assign(&self, span: Span, desc: &str) -> Diag<'infcx> {
265265
struct_span_code_err!(self.dcx(), span, E0594, "cannot assign to {}", desc)
266266
}
267267

268268
pub(crate) fn cannot_move_out_of(
269269
&self,
270270
move_from_span: Span,
271271
move_from_desc: &str,
272-
) -> Diag<'cx> {
272+
) -> Diag<'infcx> {
273273
struct_span_code_err!(
274274
self.dcx(),
275275
move_from_span,
@@ -287,7 +287,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'_, '_, 'cx, 'tcx> {
287287
move_from_span: Span,
288288
ty: Ty<'_>,
289289
is_index: Option<bool>,
290-
) -> Diag<'cx> {
290+
) -> Diag<'infcx> {
291291
let type_name = match (&ty.kind(), is_index) {
292292
(&ty::Array(_, _), Some(true)) | (&ty::Array(_, _), None) => "array",
293293
(&ty::Slice(_), _) => "slice",
@@ -308,7 +308,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'_, '_, 'cx, 'tcx> {
308308
&self,
309309
move_from_span: Span,
310310
container_ty: Ty<'_>,
311-
) -> Diag<'cx> {
311+
) -> Diag<'infcx> {
312312
struct_span_code_err!(
313313
self.dcx(),
314314
move_from_span,
@@ -325,7 +325,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'_, '_, 'cx, 'tcx> {
325325
verb: &str,
326326
optional_adverb_for_moved: &str,
327327
moved_path: Option<String>,
328-
) -> Diag<'cx> {
328+
) -> Diag<'infcx> {
329329
let moved_path = moved_path.map(|mp| format!(": `{mp}`")).unwrap_or_default();
330330

331331
struct_span_code_err!(
@@ -344,7 +344,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'_, '_, 'cx, 'tcx> {
344344
span: Span,
345345
path: &str,
346346
reason: &str,
347-
) -> Diag<'cx> {
347+
) -> Diag<'infcx> {
348348
struct_span_code_err!(
349349
self.dcx(),
350350
span,
@@ -362,7 +362,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'_, '_, 'cx, 'tcx> {
362362
immutable_place: &str,
363363
immutable_section: &str,
364364
action: &str,
365-
) -> Diag<'cx> {
365+
) -> Diag<'infcx> {
366366
struct_span_code_err!(
367367
self.dcx(),
368368
mutate_span,
@@ -380,7 +380,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'_, '_, 'cx, 'tcx> {
380380
&self,
381381
span: Span,
382382
yield_span: Span,
383-
) -> Diag<'cx> {
383+
) -> Diag<'infcx> {
384384
let coroutine_kind = self.body.coroutine.as_ref().unwrap().coroutine_kind;
385385
struct_span_code_err!(
386386
self.dcx(),
@@ -391,7 +391,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'_, '_, 'cx, 'tcx> {
391391
.with_span_label(yield_span, "possible yield occurs here")
392392
}
393393

394-
pub(crate) fn cannot_borrow_across_destructor(&self, borrow_span: Span) -> Diag<'cx> {
394+
pub(crate) fn cannot_borrow_across_destructor(&self, borrow_span: Span) -> Diag<'infcx> {
395395
struct_span_code_err!(
396396
self.dcx(),
397397
borrow_span,
@@ -400,7 +400,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'_, '_, 'cx, 'tcx> {
400400
)
401401
}
402402

403-
pub(crate) fn path_does_not_live_long_enough(&self, span: Span, path: &str) -> Diag<'cx> {
403+
pub(crate) fn path_does_not_live_long_enough(&self, span: Span, path: &str) -> Diag<'infcx> {
404404
struct_span_code_err!(self.dcx(), span, E0597, "{} does not live long enough", path,)
405405
}
406406

@@ -410,7 +410,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'_, '_, 'cx, 'tcx> {
410410
return_kind: &str,
411411
reference_desc: &str,
412412
path_desc: &str,
413-
) -> Diag<'cx> {
413+
) -> Diag<'infcx> {
414414
struct_span_code_err!(
415415
self.dcx(),
416416
span,
@@ -433,7 +433,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'_, '_, 'cx, 'tcx> {
433433
borrowed_path: &str,
434434
capture_span: Span,
435435
scope: &str,
436-
) -> Diag<'cx> {
436+
) -> Diag<'infcx> {
437437
struct_span_code_err!(
438438
self.dcx(),
439439
closure_span,
@@ -445,7 +445,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'_, '_, 'cx, 'tcx> {
445445
.with_span_label(closure_span, format!("may outlive borrowed value {borrowed_path}"))
446446
}
447447

448-
pub(crate) fn thread_local_value_does_not_live_long_enough(&self, span: Span) -> Diag<'cx> {
448+
pub(crate) fn thread_local_value_does_not_live_long_enough(&self, span: Span) -> Diag<'infcx> {
449449
struct_span_code_err!(
450450
self.dcx(),
451451
span,
@@ -454,7 +454,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'_, '_, 'cx, 'tcx> {
454454
)
455455
}
456456

457-
pub(crate) fn temporary_value_borrowed_for_too_long(&self, span: Span) -> Diag<'cx> {
457+
pub(crate) fn temporary_value_borrowed_for_too_long(&self, span: Span) -> Diag<'infcx> {
458458
struct_span_code_err!(self.dcx(), span, E0716, "temporary value dropped while borrowed",)
459459
}
460460
}

compiler/rustc_borrowck/src/diagnostics/bound_region_errors.rs

+15-15
Original file line numberDiff line numberDiff line change
@@ -149,13 +149,13 @@ trait TypeOpInfo<'tcx> {
149149

150150
fn base_universe(&self) -> ty::UniverseIndex;
151151

152-
fn nice_error<'cx>(
152+
fn nice_error<'infcx>(
153153
&self,
154-
mbcx: &mut MirBorrowckCtxt<'_, '_, 'cx, 'tcx>,
154+
mbcx: &mut MirBorrowckCtxt<'_, '_, 'infcx, 'tcx>,
155155
cause: ObligationCause<'tcx>,
156156
placeholder_region: ty::Region<'tcx>,
157157
error_region: Option<ty::Region<'tcx>>,
158-
) -> Option<Diag<'cx>>;
158+
) -> Option<Diag<'infcx>>;
159159

160160
#[instrument(level = "debug", skip(self, mbcx))]
161161
fn report_error(
@@ -231,13 +231,13 @@ impl<'tcx> TypeOpInfo<'tcx> for PredicateQuery<'tcx> {
231231
self.base_universe
232232
}
233233

234-
fn nice_error<'cx>(
234+
fn nice_error<'infcx>(
235235
&self,
236-
mbcx: &mut MirBorrowckCtxt<'_, '_, 'cx, 'tcx>,
236+
mbcx: &mut MirBorrowckCtxt<'_, '_, 'infcx, 'tcx>,
237237
cause: ObligationCause<'tcx>,
238238
placeholder_region: ty::Region<'tcx>,
239239
error_region: Option<ty::Region<'tcx>>,
240-
) -> Option<Diag<'cx>> {
240+
) -> Option<Diag<'infcx>> {
241241
let (infcx, key, _) =
242242
mbcx.infcx.tcx.infer_ctxt().build_with_canonical(cause.span, &self.canonical_query);
243243
let ocx = ObligationCtxt::new(&infcx);
@@ -275,13 +275,13 @@ where
275275
self.base_universe
276276
}
277277

278-
fn nice_error<'cx>(
278+
fn nice_error<'infcx>(
279279
&self,
280-
mbcx: &mut MirBorrowckCtxt<'_, '_, 'cx, 'tcx>,
280+
mbcx: &mut MirBorrowckCtxt<'_, '_, 'infcx, 'tcx>,
281281
cause: ObligationCause<'tcx>,
282282
placeholder_region: ty::Region<'tcx>,
283283
error_region: Option<ty::Region<'tcx>>,
284-
) -> Option<Diag<'cx>> {
284+
) -> Option<Diag<'infcx>> {
285285
let (infcx, key, _) =
286286
mbcx.infcx.tcx.infer_ctxt().build_with_canonical(cause.span, &self.canonical_query);
287287
let ocx = ObligationCtxt::new(&infcx);
@@ -322,13 +322,13 @@ impl<'tcx> TypeOpInfo<'tcx> for AscribeUserTypeQuery<'tcx> {
322322
self.base_universe
323323
}
324324

325-
fn nice_error<'cx>(
325+
fn nice_error<'infcx>(
326326
&self,
327-
mbcx: &mut MirBorrowckCtxt<'_, '_, 'cx, 'tcx>,
327+
mbcx: &mut MirBorrowckCtxt<'_, '_, 'infcx, 'tcx>,
328328
cause: ObligationCause<'tcx>,
329329
placeholder_region: ty::Region<'tcx>,
330330
error_region: Option<ty::Region<'tcx>>,
331-
) -> Option<Diag<'cx>> {
331+
) -> Option<Diag<'infcx>> {
332332
let (infcx, key, _) =
333333
mbcx.infcx.tcx.infer_ctxt().build_with_canonical(cause.span, &self.canonical_query);
334334
let ocx = ObligationCtxt::new(&infcx);
@@ -355,13 +355,13 @@ impl<'tcx> TypeOpInfo<'tcx> for crate::type_check::InstantiateOpaqueType<'tcx> {
355355
self.base_universe.unwrap()
356356
}
357357

358-
fn nice_error<'cx>(
358+
fn nice_error<'infcx>(
359359
&self,
360-
mbcx: &mut MirBorrowckCtxt<'_, '_, 'cx, 'tcx>,
360+
mbcx: &mut MirBorrowckCtxt<'_, '_, 'infcx, 'tcx>,
361361
_cause: ObligationCause<'tcx>,
362362
placeholder_region: ty::Region<'tcx>,
363363
error_region: Option<ty::Region<'tcx>>,
364-
) -> Option<Diag<'cx>> {
364+
) -> Option<Diag<'infcx>> {
365365
try_extract_error_from_region_constraints(
366366
mbcx.infcx,
367367
mbcx.mir_def_id(),

0 commit comments

Comments
 (0)