From fbf49715c96c01dcd7745160638461f7011d41da Mon Sep 17 00:00:00 2001 From: Scott Olson Date: Fri, 18 Dec 2015 22:22:34 -0600 Subject: [PATCH] Update for upstream addition of ItemKind. --- src/interpreter.rs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/interpreter.rs b/src/interpreter.rs index b2bb03b04cd7..f5a60770f7fd 100644 --- a/src/interpreter.rs +++ b/src/interpreter.rs @@ -331,7 +331,7 @@ impl<'a, 'tcx> Interpreter<'a, 'tcx> { Value::Adt { variant: variant, data_ptr: ptr } } - _ => unimplemented!(), + ref r => panic!("can't handle rvalue: {:?}", r), } } @@ -343,12 +343,10 @@ impl<'a, 'tcx> Interpreter<'a, 'tcx> { match constant.literal { mir::Literal::Value { ref value } => self.eval_constant(value), - mir::Literal::Item { def_id, substs: _ } => { - // FIXME(tsion): Only items of function type should be wrapped into Func - // values. One test currently fails because a unit-like enum variant gets - // wrapped into Func here instead of a Value::Adt. - Value::Func(def_id) - } + mir::Literal::Item { def_id, kind, .. } => match kind { + mir::ItemKind::Function | mir::ItemKind::Method => Value::Func(def_id), + _ => panic!("can't handle item literal: {:?}", constant.literal), + }, } } }