Skip to content

Commit 693c0e8

Browse files
authored
Rollup merge of rust-lang#163082 - nnethercote:rm-TypeChecker-root_cx, r=chenyukang
Remove `TypeChecker::root_cx` It's only used for `self.root_cx.root_def_id()`, but `self.infcx.root_def_id` is also available. r? @lqd
2 parents 8546e35 + 93c8966 commit 693c0e8

2 files changed

Lines changed: 2 additions & 6 deletions

File tree

compiler/rustc_borrowck/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,6 @@ fn borrowck_collect_region_constraints<'tcx>(
361361
deferred_closure_requirements,
362362
polonius_context,
363363
} = type_check::type_check(
364-
root_cx,
365364
&infcx,
366365
body,
367366
&promoted,

compiler/rustc_borrowck/src/type_check/mod.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ use crate::region_infer::values::{LivenessValues, PlaceholderIndex, PlaceholderI
4747
use crate::session_diagnostics::{MoveUnsized, SimdIntrinsicArgConst};
4848
use crate::type_check::free_region_relations::{CreateResult, UniversalRegionRelations};
4949
use crate::universal_regions::{DefiningTy, UniversalRegions};
50-
use crate::{BorrowCheckRootCtxt, BorrowckInferCtxt, DeferredClosureRequirements, path_utils};
50+
use crate::{BorrowckInferCtxt, DeferredClosureRequirements, path_utils};
5151

5252
macro_rules! span_mirbug {
5353
($context:expr, $elem:expr, $($message:tt)*) => ({
@@ -94,7 +94,6 @@ mod relate_tys;
9494
/// - `move_data` -- move-data constructed when performing the maybe-init dataflow analysis
9595
/// - `location_map` -- map between MIR `Location` and `PointIndex`
9696
pub(crate) fn type_check<'tcx>(
97-
root_cx: &BorrowCheckRootCtxt<'_, 'tcx>,
9897
infcx: &BorrowckInferCtxt<'tcx>,
9998
body: &Body<'tcx>,
10099
promoted: &IndexSlice<Promoted, Body<'tcx>>,
@@ -145,7 +144,6 @@ pub(crate) fn type_check<'tcx>(
145144

146145
let mut deferred_closure_requirements = Default::default();
147146
let mut typeck = TypeChecker {
148-
root_cx,
149147
infcx,
150148
last_span: body.span,
151149
body,
@@ -227,7 +225,6 @@ enum FieldAccessError {
227225
/// way, it accrues region constraints -- these can later be used by
228226
/// NLL region checking.
229227
struct TypeChecker<'a, 'tcx> {
230-
root_cx: &'a BorrowCheckRootCtxt<'a, 'tcx>,
231228
infcx: &'a BorrowckInferCtxt<'tcx>,
232229
last_span: Span,
233230
body: &'a Body<'tcx>,
@@ -2715,7 +2712,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
27152712
args: GenericArgsRef<'tcx>,
27162713
location: Location,
27172714
) -> ty::InstantiatedClauses<'tcx> {
2718-
let root_def_id = self.root_cx.root_def_id();
2715+
let root_def_id = self.infcx.root_def_id;
27192716
// We will have to handle propagated closure requirements for this closure,
27202717
// but need to defer this until the nested body has been fully borrow checked.
27212718
self.deferred_closure_requirements.push((def_id, args, location.to_locations()));

0 commit comments

Comments
 (0)