From 13e421a9796a36b453feb23d89606cf5f94cee63 Mon Sep 17 00:00:00 2001 From: Daniel Watkins Date: Sat, 4 Aug 2018 00:53:01 -0400 Subject: [PATCH] Add more information to unimplemented! panics --- vm/src/objbool.rs | 3 +-- vm/src/objlist.rs | 2 +- vm/src/objtuple.rs | 2 +- vm/src/vm.rs | 6 +++--- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/vm/src/objbool.rs b/vm/src/objbool.rs index 4e01715a4..fddc822db 100644 --- a/vm/src/objbool.rs +++ b/vm/src/objbool.rs @@ -6,7 +6,6 @@ pub fn boolval(o: PyObjectRef) -> bool { match obj.kind { PyObjectKind::Boolean { value } => value, PyObjectKind::Integer { value } => value != 0, - _ => unimplemented!(), + ref kind => unimplemented!("converting to boolean unsupported for: {:?}", kind), } } - diff --git a/vm/src/objlist.rs b/vm/src/objlist.rs index 8379f0437..7659e078a 100644 --- a/vm/src/objlist.rs +++ b/vm/src/objlist.rs @@ -32,7 +32,7 @@ pub fn get_item(vm: &mut VirtualMachine, l: &Vec, b: PyObjectRef) - let step = match step { //Some(step) => step as usize, &None => 1 as usize, - _ => unimplemented!(), + _ => unimplemented!("stepped slicing not supported for type {:?}", l), }; // TODO: we could potentially avoid this copy and use slice let obj = PyObject::new( diff --git a/vm/src/objtuple.rs b/vm/src/objtuple.rs index 1042b3761..3dd4c28d4 100644 --- a/vm/src/objtuple.rs +++ b/vm/src/objtuple.rs @@ -32,7 +32,7 @@ pub fn get_item(vm: &mut VirtualMachine, l: &Vec, b: PyObjectRef) - let step = match step { //Some(step) => step as usize, &None => 1 as usize, - _ => unimplemented!(), + _ => unimplemented!("stepped slicing not supported for type {:?}", l), }; // TODO: we could potentially avoid this copy and use slice let obj = PyObject::new( diff --git a/vm/src/vm.rs b/vm/src/vm.rs index e3045e3b1..5ee353a26 100644 --- a/vm/src/vm.rs +++ b/vm/src/vm.rs @@ -476,8 +476,8 @@ impl VirtualMachine { self.run_frame(frame) } PyObjectKind::Class { name: _ } => self.new_instance(func_ref.clone(), args), - _ => { - unimplemented!(); + ref kind => { + unimplemented!("invoke unimplemented for: {:?}", kind); } } } @@ -498,7 +498,7 @@ impl VirtualMachine { // Lookup name in obj let obj = match parent.borrow().kind { PyObjectKind::Module { ref name, ref dict } => dict.get_item(attr_name), - _ => unimplemented!(), + ref kind => unimplemented!("load_attr unimplemented for: {:?}", kind), }; self.push_value(obj); None