Skip to content

Commit 314315a

Browse files
committed
Make more infcx variables &mut
1 parent 83f2ae3 commit 314315a

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

compiler/rustc_infer/src/infer/mod.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -1315,7 +1315,8 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
13151315
if !value.needs_infer() {
13161316
return value; // Avoid duplicated subst-folding.
13171317
}
1318-
let mut r = resolve::OpportunisticVarResolver::new(self);
1318+
let infcx: &mut Self = unimplemented!();
1319+
let mut r = resolve::OpportunisticVarResolver::new(infcx);
13191320
value.fold_with(&mut r)
13201321
}
13211322

@@ -1324,7 +1325,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
13241325
/// type variables in `T`, but it never constructs the final,
13251326
/// resolved type, so it's more efficient than
13261327
/// `resolve_vars_if_possible()`.
1327-
pub fn unresolved_type_vars<T>(&self, value: &T) -> Option<(Ty<'tcx>, Option<Span>)>
1328+
pub fn unresolved_type_vars<T>(&mut self, value: &T) -> Option<(Ty<'tcx>, Option<Span>)>
13281329
where
13291330
T: TypeFoldable<'tcx>,
13301331
{

compiler/rustc_infer/src/infer/resolve.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,18 @@ use std::ops::ControlFlow;
1313
/// been unified with (similar to `shallow_resolve`, but deep). This is
1414
/// useful for printing messages etc but also required at various
1515
/// points for correctness.
16-
pub struct OpportunisticVarResolver<'a, 'tcx> {
17-
infcx: &'a InferCtxt<'a, 'tcx>,
16+
pub struct OpportunisticVarResolver<'a, 'cx, 'tcx> {
17+
infcx: &'a mut InferCtxt<'cx, 'tcx>,
1818
}
1919

20-
impl<'a, 'tcx> OpportunisticVarResolver<'a, 'tcx> {
20+
impl<'a, 'cx, 'tcx> OpportunisticVarResolver<'a, 'cx, 'tcx> {
2121
#[inline]
22-
pub fn new(infcx: &'a InferCtxt<'a, 'tcx>) -> Self {
22+
pub fn new(infcx: &'a mut InferCtxt<'cx, 'tcx>) -> Self {
2323
OpportunisticVarResolver { infcx }
2424
}
2525
}
2626

27-
impl<'a, 'tcx> TypeFolder<'tcx> for OpportunisticVarResolver<'a, 'tcx> {
27+
impl<'a, 'tcx> TypeFolder<'tcx> for OpportunisticVarResolver<'a, '_, 'tcx> {
2828
fn tcx<'b>(&'b self) -> TyCtxt<'tcx> {
2929
self.infcx.tcx
3030
}
@@ -108,17 +108,17 @@ impl<'a, 'tcx> TypeFolder<'tcx> for OpportunisticRegionResolver<'a, 'tcx> {
108108
/// type variables that don't yet have a value. The first unresolved type is stored.
109109
/// It does not construct the fully resolved type (which might
110110
/// involve some hashing and so forth).
111-
pub struct UnresolvedTypeFinder<'a, 'tcx> {
112-
infcx: &'a InferCtxt<'a, 'tcx>,
111+
pub struct UnresolvedTypeFinder<'a, 'cx, 'tcx> {
112+
infcx: &'a mut InferCtxt<'cx, 'tcx>,
113113
}
114114

115-
impl<'a, 'tcx> UnresolvedTypeFinder<'a, 'tcx> {
116-
pub fn new(infcx: &'a InferCtxt<'a, 'tcx>) -> Self {
115+
impl<'a, 'cx, 'tcx> UnresolvedTypeFinder<'a, 'cx, 'tcx> {
116+
pub fn new(infcx: &'a mut InferCtxt<'cx, 'tcx>) -> Self {
117117
UnresolvedTypeFinder { infcx }
118118
}
119119
}
120120

121-
impl<'a, 'tcx> TypeVisitor<'tcx> for UnresolvedTypeFinder<'a, 'tcx> {
121+
impl<'a, 'tcx> TypeVisitor<'tcx> for UnresolvedTypeFinder<'a, '_, 'tcx> {
122122
type BreakTy = (Ty<'tcx>, Option<Span>);
123123
fn visit_ty(&mut self, t: Ty<'tcx>) -> ControlFlow<Self::BreakTy> {
124124
let t = self.infcx.shallow_resolve(t);

0 commit comments

Comments
 (0)