Skip to content

Commit 56e7fb3

Browse files
committed
mutable fields fixes
1 parent dad3dc4 commit 56e7fb3

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

compiler/rustc_infer/src/infer/fudge.rs

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ struct VariableLengths {
4444
}
4545

4646
impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
47-
fn variable_lengths(&self) -> VariableLengths {
48-
let mut inner = self.inner;
47+
fn variable_lengths(&mut self) -> VariableLengths {
48+
let inner = &mut self.inner;
4949
VariableLengths {
5050
type_var_len: inner.type_variables().num_vars(),
5151
const_var_len: inner.const_unification_table().len(),
@@ -94,7 +94,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
9494
/// the actual types (`?T`, `Option<?T>`) -- and remember that
9595
/// after the snapshot is popped, the variable `?T` is no longer
9696
/// unified.
97-
pub fn fudge_inference_if_ok<T, E, F>(&self, f: F) -> Result<T, E>
97+
pub fn fudge_inference_if_ok<T, E, F>(&mut self, f: F) -> Result<T, E>
9898
where
9999
F: FnOnce() -> Result<T, E>,
100100
T: TypeFoldable<'tcx>,
@@ -113,27 +113,26 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
113113
// going to be popped, so we will have to
114114
// eliminate any references to them.
115115

116-
let mut inner = this.inner;
117-
let type_vars =
116+
let type_vars = this.
118117
inner.type_variables().vars_since_snapshot(variable_lengths.type_var_len);
119118
let int_vars = vars_since_snapshot(
120-
&mut inner.int_unification_table(),
119+
&mut this.inner.int_unification_table(),
121120
variable_lengths.int_var_len,
122121
);
123122
let float_vars = vars_since_snapshot(
124-
&mut inner.float_unification_table(),
123+
&mut this.inner.float_unification_table(),
125124
variable_lengths.float_var_len,
126125
);
127-
let region_vars = inner
126+
let region_vars = this.inner
128127
.unwrap_region_constraints()
129128
.vars_since_snapshot(variable_lengths.region_constraints_len);
130129
let const_vars = const_vars_since_snapshot(
131-
&mut inner.const_unification_table(),
130+
&mut this.inner.const_unification_table(),
132131
variable_lengths.const_var_len,
133132
);
134133

135134
let fudger = InferenceFudger {
136-
infcx: self,
135+
infcx: this,
137136
type_vars,
138137
int_vars,
139138
float_vars,

0 commit comments

Comments
 (0)