Skip to content

Commit 49ef3da

Browse files
Take FnMut instead of Fn in Qualif methods
1 parent 34700c1 commit 49ef3da

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

src/librustc_mir/transform/check_consts/qualifs.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ pub trait Qualif {
3434

3535
fn in_projection_structurally(
3636
cx: &ConstCx<'_, 'tcx>,
37-
per_local: &impl Fn(Local) -> bool,
37+
per_local: &mut impl FnMut(Local) -> bool,
3838
place: PlaceRef<'_, 'tcx>,
3939
) -> bool {
4040
if let [proj_base @ .., elem] = place.projection {
@@ -66,15 +66,15 @@ pub trait Qualif {
6666

6767
fn in_projection(
6868
cx: &ConstCx<'_, 'tcx>,
69-
per_local: &impl Fn(Local) -> bool,
69+
per_local: &mut impl FnMut(Local) -> bool,
7070
place: PlaceRef<'_, 'tcx>,
7171
) -> bool {
7272
Self::in_projection_structurally(cx, per_local, place)
7373
}
7474

7575
fn in_place(
7676
cx: &ConstCx<'_, 'tcx>,
77-
per_local: &impl Fn(Local) -> bool,
77+
per_local: &mut impl FnMut(Local) -> bool,
7878
place: PlaceRef<'_, 'tcx>,
7979
) -> bool {
8080
match place {
@@ -85,7 +85,7 @@ pub trait Qualif {
8585

8686
fn in_operand(
8787
cx: &ConstCx<'_, 'tcx>,
88-
per_local: &impl Fn(Local) -> bool,
88+
per_local: &mut impl FnMut(Local) -> bool,
8989
operand: &Operand<'tcx>,
9090
) -> bool {
9191
match *operand {
@@ -126,7 +126,7 @@ pub trait Qualif {
126126

127127
fn in_rvalue_structurally(
128128
cx: &ConstCx<'_, 'tcx>,
129-
per_local: &impl Fn(Local) -> bool,
129+
per_local: &mut impl FnMut(Local) -> bool,
130130
rvalue: &Rvalue<'tcx>,
131131
) -> bool {
132132
match *rvalue {
@@ -170,15 +170,15 @@ pub trait Qualif {
170170

171171
fn in_rvalue(
172172
cx: &ConstCx<'_, 'tcx>,
173-
per_local: &impl Fn(Local) -> bool,
173+
per_local: &mut impl FnMut(Local) -> bool,
174174
rvalue: &Rvalue<'tcx>,
175175
) -> bool {
176176
Self::in_rvalue_structurally(cx, per_local, rvalue)
177177
}
178178

179179
fn in_call(
180180
cx: &ConstCx<'_, 'tcx>,
181-
_per_local: &impl Fn(Local) -> bool,
181+
_per_local: &mut impl FnMut(Local) -> bool,
182182
_callee: &Operand<'tcx>,
183183
_args: &[Operand<'tcx>],
184184
return_ty: Ty<'tcx>,
@@ -208,7 +208,7 @@ impl Qualif for HasMutInterior {
208208

209209
fn in_rvalue(
210210
cx: &ConstCx<'_, 'tcx>,
211-
per_local: &impl Fn(Local) -> bool,
211+
per_local: &mut impl FnMut(Local) -> bool,
212212
rvalue: &Rvalue<'tcx>,
213213
) -> bool {
214214
match *rvalue {
@@ -249,7 +249,7 @@ impl Qualif for NeedsDrop {
249249

250250
fn in_rvalue(
251251
cx: &ConstCx<'_, 'tcx>,
252-
per_local: &impl Fn(Local) -> bool,
252+
per_local: &mut impl FnMut(Local) -> bool,
253253
rvalue: &Rvalue<'tcx>,
254254
) -> bool {
255255
if let Rvalue::Aggregate(ref kind, _) = *rvalue {

src/librustc_mir/transform/check_consts/validation.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ impl Validator<'a, 'mir, 'tcx> {
253253

254254
let borrowed_place_has_mut_interior = HasMutInterior::in_place(
255255
&self.item,
256-
&|local| self.qualifs.has_mut_interior_eager_seek(local),
256+
&mut |local| self.qualifs.has_mut_interior_eager_seek(local),
257257
place.as_ref(),
258258
);
259259

0 commit comments

Comments
 (0)