Take `FnMut` instead of `Fn` in `Qualif` methods

This commit is contained in:
Dylan MacKenzie 2020-02-03 10:27:38 -08:00
parent 34700c15c7
commit 49ef3dac69
2 changed files with 10 additions and 10 deletions

View File

@ -34,7 +34,7 @@ pub trait Qualif {
fn in_projection_structurally( fn in_projection_structurally(
cx: &ConstCx<'_, 'tcx>, cx: &ConstCx<'_, 'tcx>,
per_local: &impl Fn(Local) -> bool, per_local: &mut impl FnMut(Local) -> bool,
place: PlaceRef<'_, 'tcx>, place: PlaceRef<'_, 'tcx>,
) -> bool { ) -> bool {
if let [proj_base @ .., elem] = place.projection { if let [proj_base @ .., elem] = place.projection {
@ -66,7 +66,7 @@ pub trait Qualif {
fn in_projection( fn in_projection(
cx: &ConstCx<'_, 'tcx>, cx: &ConstCx<'_, 'tcx>,
per_local: &impl Fn(Local) -> bool, per_local: &mut impl FnMut(Local) -> bool,
place: PlaceRef<'_, 'tcx>, place: PlaceRef<'_, 'tcx>,
) -> bool { ) -> bool {
Self::in_projection_structurally(cx, per_local, place) Self::in_projection_structurally(cx, per_local, place)
@ -74,7 +74,7 @@ pub trait Qualif {
fn in_place( fn in_place(
cx: &ConstCx<'_, 'tcx>, cx: &ConstCx<'_, 'tcx>,
per_local: &impl Fn(Local) -> bool, per_local: &mut impl FnMut(Local) -> bool,
place: PlaceRef<'_, 'tcx>, place: PlaceRef<'_, 'tcx>,
) -> bool { ) -> bool {
match place { match place {
@ -85,7 +85,7 @@ pub trait Qualif {
fn in_operand( fn in_operand(
cx: &ConstCx<'_, 'tcx>, cx: &ConstCx<'_, 'tcx>,
per_local: &impl Fn(Local) -> bool, per_local: &mut impl FnMut(Local) -> bool,
operand: &Operand<'tcx>, operand: &Operand<'tcx>,
) -> bool { ) -> bool {
match *operand { match *operand {
@ -126,7 +126,7 @@ pub trait Qualif {
fn in_rvalue_structurally( fn in_rvalue_structurally(
cx: &ConstCx<'_, 'tcx>, cx: &ConstCx<'_, 'tcx>,
per_local: &impl Fn(Local) -> bool, per_local: &mut impl FnMut(Local) -> bool,
rvalue: &Rvalue<'tcx>, rvalue: &Rvalue<'tcx>,
) -> bool { ) -> bool {
match *rvalue { match *rvalue {
@ -170,7 +170,7 @@ pub trait Qualif {
fn in_rvalue( fn in_rvalue(
cx: &ConstCx<'_, 'tcx>, cx: &ConstCx<'_, 'tcx>,
per_local: &impl Fn(Local) -> bool, per_local: &mut impl FnMut(Local) -> bool,
rvalue: &Rvalue<'tcx>, rvalue: &Rvalue<'tcx>,
) -> bool { ) -> bool {
Self::in_rvalue_structurally(cx, per_local, rvalue) Self::in_rvalue_structurally(cx, per_local, rvalue)
@ -178,7 +178,7 @@ pub trait Qualif {
fn in_call( fn in_call(
cx: &ConstCx<'_, 'tcx>, cx: &ConstCx<'_, 'tcx>,
_per_local: &impl Fn(Local) -> bool, _per_local: &mut impl FnMut(Local) -> bool,
_callee: &Operand<'tcx>, _callee: &Operand<'tcx>,
_args: &[Operand<'tcx>], _args: &[Operand<'tcx>],
return_ty: Ty<'tcx>, return_ty: Ty<'tcx>,
@ -208,7 +208,7 @@ impl Qualif for HasMutInterior {
fn in_rvalue( fn in_rvalue(
cx: &ConstCx<'_, 'tcx>, cx: &ConstCx<'_, 'tcx>,
per_local: &impl Fn(Local) -> bool, per_local: &mut impl FnMut(Local) -> bool,
rvalue: &Rvalue<'tcx>, rvalue: &Rvalue<'tcx>,
) -> bool { ) -> bool {
match *rvalue { match *rvalue {
@ -249,7 +249,7 @@ impl Qualif for NeedsDrop {
fn in_rvalue( fn in_rvalue(
cx: &ConstCx<'_, 'tcx>, cx: &ConstCx<'_, 'tcx>,
per_local: &impl Fn(Local) -> bool, per_local: &mut impl FnMut(Local) -> bool,
rvalue: &Rvalue<'tcx>, rvalue: &Rvalue<'tcx>,
) -> bool { ) -> bool {
if let Rvalue::Aggregate(ref kind, _) = *rvalue { if let Rvalue::Aggregate(ref kind, _) = *rvalue {

View File

@ -253,7 +253,7 @@ impl Validator<'a, 'mir, 'tcx> {
let borrowed_place_has_mut_interior = HasMutInterior::in_place( let borrowed_place_has_mut_interior = HasMutInterior::in_place(
&self.item, &self.item,
&|local| self.qualifs.has_mut_interior_eager_seek(local), &mut |local| self.qualifs.has_mut_interior_eager_seek(local),
place.as_ref(), place.as_ref(),
); );