1
Fork 0

rustc_const_eval: remove ref patterns (+some pattern matching imps)

This commit is contained in:
Maybe Waffle 2022-12-23 15:15:21 +00:00
parent 85357e3e2e
commit 3dca58e249
14 changed files with 125 additions and 139 deletions

View file

@ -363,11 +363,11 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
src: &OpTy<'tcx, M::Provenance>,
) -> InterpResult<'tcx, Either<MPlaceTy<'tcx, M::Provenance>, ImmTy<'tcx, M::Provenance>>> {
Ok(match src.as_mplace_or_imm() {
Left(ref mplace) => {
if let Some(val) = self.read_immediate_from_mplace_raw(mplace)? {
Left(mplace) => {
if let Some(val) = self.read_immediate_from_mplace_raw(&mplace)? {
Right(val)
} else {
Left(*mplace)
Left(mplace)
}
}
Right(val) => Right(val),
@ -533,11 +533,11 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
layout: Option<TyAndLayout<'tcx>>,
) -> InterpResult<'tcx, OpTy<'tcx, M::Provenance>> {
use rustc_middle::mir::Operand::*;
let op = match *mir_op {
let op = match mir_op {
// FIXME: do some more logic on `move` to invalidate the old location
Copy(place) | Move(place) => self.eval_place_to_op(place, layout)?,
&(Copy(place) | Move(place)) => self.eval_place_to_op(place, layout)?,
Constant(ref constant) => {
Constant(constant) => {
let c =
self.subst_from_current_frame_and_normalize_erasing_regions(constant.literal)?;