Pull out a statement that all match arms are executing
This commit is contained in:
parent
4bff385fda
commit
fb5b268aa8
1 changed files with 4 additions and 5 deletions
|
@ -771,16 +771,15 @@ impl<'a, 'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M
|
||||||
Cast(kind, ref operand, cast_ty) => {
|
Cast(kind, ref operand, cast_ty) => {
|
||||||
debug_assert_eq!(self.monomorphize(cast_ty, self.substs()), dest_ty);
|
debug_assert_eq!(self.monomorphize(cast_ty, self.substs()), dest_ty);
|
||||||
use rustc::mir::CastKind::*;
|
use rustc::mir::CastKind::*;
|
||||||
|
let src = self.eval_operand(operand)?;
|
||||||
match kind {
|
match kind {
|
||||||
Unsize => {
|
Unsize => {
|
||||||
let src = self.eval_operand(operand)?;
|
|
||||||
let src_layout = self.layout_of(src.ty)?;
|
let src_layout = self.layout_of(src.ty)?;
|
||||||
let dst_layout = self.layout_of(dest_ty)?;
|
let dst_layout = self.layout_of(dest_ty)?;
|
||||||
self.unsize_into(src.value, src_layout, dest, dst_layout)?;
|
self.unsize_into(src.value, src_layout, dest, dst_layout)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
Misc => {
|
Misc => {
|
||||||
let src = self.eval_operand(operand)?;
|
|
||||||
if self.type_is_fat_ptr(src.ty) {
|
if self.type_is_fat_ptr(src.ty) {
|
||||||
match (src.value, self.type_is_fat_ptr(dest_ty)) {
|
match (src.value, self.type_is_fat_ptr(dest_ty)) {
|
||||||
(Value::ByRef { .. }, _) |
|
(Value::ByRef { .. }, _) |
|
||||||
|
@ -840,7 +839,7 @@ impl<'a, 'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M
|
||||||
}
|
}
|
||||||
|
|
||||||
ReifyFnPointer => {
|
ReifyFnPointer => {
|
||||||
match self.eval_operand(operand)?.ty.sty {
|
match src.ty.sty {
|
||||||
ty::TyFnDef(def_id, substs) => {
|
ty::TyFnDef(def_id, substs) => {
|
||||||
if self.tcx.has_attr(def_id, "rustc_args_required_const") {
|
if self.tcx.has_attr(def_id, "rustc_args_required_const") {
|
||||||
bug!("reifying a fn ptr that requires \
|
bug!("reifying a fn ptr that requires \
|
||||||
|
@ -866,7 +865,7 @@ impl<'a, 'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M
|
||||||
UnsafeFnPointer => {
|
UnsafeFnPointer => {
|
||||||
match dest_ty.sty {
|
match dest_ty.sty {
|
||||||
ty::TyFnPtr(_) => {
|
ty::TyFnPtr(_) => {
|
||||||
let mut src = self.eval_operand(operand)?;
|
let mut src = src;
|
||||||
src.ty = dest_ty;
|
src.ty = dest_ty;
|
||||||
self.write_value(src, dest)?;
|
self.write_value(src, dest)?;
|
||||||
}
|
}
|
||||||
|
@ -875,7 +874,7 @@ impl<'a, 'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M
|
||||||
}
|
}
|
||||||
|
|
||||||
ClosureFnPointer => {
|
ClosureFnPointer => {
|
||||||
match self.eval_operand(operand)?.ty.sty {
|
match src.ty.sty {
|
||||||
ty::TyClosure(def_id, substs) => {
|
ty::TyClosure(def_id, substs) => {
|
||||||
let substs = self.tcx.subst_and_normalize_erasing_regions(
|
let substs = self.tcx.subst_and_normalize_erasing_regions(
|
||||||
self.substs(),
|
self.substs(),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue