Skip to content

Commit 83f2ae3

Browse files
committed
Make infcx in Resolver mut
1 parent 6e05dab commit 83f2ae3

File tree

3 files changed

+11
-13
lines changed

3 files changed

+11
-13
lines changed

compiler/rustc_infer/src/infer/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1341,7 +1341,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
13411341
}
13421342
}
13431343

1344-
pub fn fully_resolve<T: TypeFoldable<'tcx>>(&self, value: T) -> FixupResult<'tcx, T> {
1344+
pub fn fully_resolve<T: TypeFoldable<'tcx>>(&mut self, value: T) -> FixupResult<'tcx, T> {
13451345
/*!
13461346
* Attempts to resolve all type/region/const variables in
13471347
* `value`. Region inference must have been run already (e.g.,

compiler/rustc_infer/src/infer/outlives/obligations.rs

+5-6
Original file line numberDiff line numberDiff line change
@@ -81,19 +81,18 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
8181
/// available (see `region_obligations` field for more
8282
/// information).
8383
pub fn register_region_obligation(
84-
&self,
84+
&mut self,
8585
body_id: hir::HirId,
8686
obligation: RegionObligation<'tcx>,
8787
) {
8888
debug!("register_region_obligation(body_id={:?}, obligation={:?})", body_id, obligation);
8989

90-
let mut inner = self.inner;
91-
inner.undo_log.push(UndoLog::PushRegionObligation);
92-
inner.region_obligations.push((body_id, obligation));
90+
self.inner.undo_log.push(UndoLog::PushRegionObligation);
91+
self.inner.region_obligations.push((body_id, obligation));
9392
}
9493

9594
pub fn register_region_obligation_with_cause(
96-
&self,
95+
&mut self,
9796
sup_type: Ty<'tcx>,
9897
sub_region: Region<'tcx>,
9998
cause: &ObligationCause<'tcx>,
@@ -109,7 +108,7 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
109108
}
110109

111110
/// Trait queries just want to pass back type obligations "as is"
112-
pub fn take_registered_region_obligations(&self) -> Vec<(hir::HirId, RegionObligation<'tcx>)> {
111+
pub fn take_registered_region_obligations(&mut self) -> Vec<(hir::HirId, RegionObligation<'tcx>)> {
113112
std::mem::take(&mut self.inner.region_obligations)
114113
}
115114

compiler/rustc_infer/src/infer/resolve.rs

+5-6
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,7 @@ impl<'a, 'tcx> TypeVisitor<'tcx> for UnresolvedTypeFinder<'a, 'tcx> {
127127
// Since we called `shallow_resolve` above, this must
128128
// be an (as yet...) unresolved inference variable.
129129
let ty_var_span = if let ty::TyVar(ty_vid) = infer_ty {
130-
let mut inner = self.infcx.inner;
131-
let ty_vars = &inner.type_variables();
130+
let ty_vars = &self.infcx.inner.type_variables();
132131
if let TypeVariableOrigin {
133132
kind: TypeVariableOriginKind::TypeParameterDefinition(_, _),
134133
span,
@@ -160,7 +159,7 @@ impl<'a, 'tcx> TypeVisitor<'tcx> for UnresolvedTypeFinder<'a, 'tcx> {
160159
/// Full type resolution replaces all type and region variables with
161160
/// their concrete results. If any variable cannot be replaced (never unified, etc)
162161
/// then an `Err` result is returned.
163-
pub fn fully_resolve<'a, 'tcx, T>(infcx: &InferCtxt<'a, 'tcx>, value: T) -> FixupResult<'tcx, T>
162+
pub fn fully_resolve<'a, 'tcx, T>(infcx: &mut InferCtxt<'a, 'tcx>, value: T) -> FixupResult<'tcx, T>
164163
where
165164
T: TypeFoldable<'tcx>,
166165
{
@@ -174,12 +173,12 @@ where
174173

175174
// N.B. This type is not public because the protocol around checking the
176175
// `err` field is not enforceable otherwise.
177-
struct FullTypeResolver<'a, 'tcx> {
178-
infcx: &'a InferCtxt<'a, 'tcx>,
176+
struct FullTypeResolver<'a, 'cx, 'tcx> {
177+
infcx: &'a mut InferCtxt<'cx, 'tcx>,
179178
err: Option<FixupError<'tcx>>,
180179
}
181180

182-
impl<'a, 'tcx> TypeFolder<'tcx> for FullTypeResolver<'a, 'tcx> {
181+
impl<'a, 'tcx> TypeFolder<'tcx> for FullTypeResolver<'a, '_, 'tcx> {
183182
fn tcx<'b>(&'b self) -> TyCtxt<'tcx> {
184183
self.infcx.tcx
185184
}

0 commit comments

Comments
 (0)