Skip to content

Commit 07bf785

Browse files
committed
Make infcx on OpportunisticRegionResolver mut
1 parent 314315a commit 07bf785

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

compiler/rustc_infer/src/infer/nll_relate/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -877,7 +877,7 @@ where
877877
}
878878

879879
ty::Infer(ty::TyVar(vid)) => {
880-
let variables = self.delegate.infcx().inner.type_variables();
880+
let mut variables = self.delegate.infcx().inner.type_variables();
881881
let vid = variables.root_var(vid);
882882
let sub_vid = variables.sub_root_var(vid);
883883
if sub_vid == self.for_vid_sub_root {

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ impl<'a, 'tcx> OutlivesEnvironment<'tcx> {
158158
/// `RegionConstraintData`.)
159159
pub fn add_outlives_bounds<I>(
160160
&mut self,
161-
infcx: Option<&InferCtxt<'a, 'tcx>>,
161+
infcx: Option<&mut InferCtxt<'a, 'tcx>>,
162162
outlives_bounds: I,
163163
) where
164164
I: IntoIterator<Item = OutlivesBound<'tcx>>,
@@ -172,7 +172,7 @@ impl<'a, 'tcx> OutlivesEnvironment<'tcx> {
172172
r_a @ (&ty::ReEarlyBound(_) | &ty::ReFree(_)),
173173
&ty::ReVar(vid_b),
174174
) => {
175-
infcx.expect("no infcx provided but region vars found").add_given(r_a, vid_b);
175+
infcx.as_mut().expect("no infcx provided but region vars found").add_given(r_a, vid_b);
176176
}
177177
OutlivesBound::RegionSubParam(r_a, param_b) => {
178178
self.region_bound_pairs_accum.push((r_a, GenericKind::Param(param_b)));

compiler/rustc_infer/src/infer/resolve.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -55,17 +55,17 @@ impl<'a, 'tcx> TypeFolder<'tcx> for OpportunisticVarResolver<'a, '_, 'tcx> {
5555
///
5656
/// If you want to resolve type and const variables as well, call
5757
/// [InferCtxt::resolve_vars_if_possible] first.
58-
pub struct OpportunisticRegionResolver<'a, 'tcx> {
59-
infcx: &'a InferCtxt<'a, 'tcx>,
58+
pub struct OpportunisticRegionResolver<'a, 'cx, 'tcx> {
59+
infcx: &'a mut InferCtxt<'cx, 'tcx>,
6060
}
6161

62-
impl<'a, 'tcx> OpportunisticRegionResolver<'a, 'tcx> {
63-
pub fn new(infcx: &'a InferCtxt<'a, 'tcx>) -> Self {
62+
impl<'a, 'cx, 'tcx> OpportunisticRegionResolver<'a, 'cx, 'tcx> {
63+
pub fn new(infcx: &'a mut InferCtxt<'cx, 'tcx>) -> Self {
6464
OpportunisticRegionResolver { infcx }
6565
}
6666
}
6767

68-
impl<'a, 'tcx> TypeFolder<'tcx> for OpportunisticRegionResolver<'a, 'tcx> {
68+
impl<'a, 'tcx> TypeFolder<'tcx> for OpportunisticRegionResolver<'a, '_, 'tcx> {
6969
fn tcx<'b>(&'b self) -> TyCtxt<'tcx> {
7070
self.infcx.tcx
7171
}

0 commit comments

Comments
 (0)