[Rust] Fix issue with CPP enums. (#4019)
authorPaddy Horan <paddyhoran@hotmail.com>
Fri, 27 Sep 2019 16:41:31 +0000 (12:41 -0400)
committerNick Hynes <nhynes@berkeley.edu>
Fri, 27 Sep 2019 16:41:31 +0000 (09:41 -0700)
rust/common/src/array.rs
rust/common/src/packed_func.rs

index 5cc8cc2..d0a66a6 100644 (file)
@@ -97,7 +97,7 @@ pub struct TVMContext {
 impl<'a> From<&'a TVMContext> for DLContext {
     fn from(ctx: &'a TVMContext) -> Self {
         Self {
-            device_type: ctx.device_type as i32,
+            device_type: ctx.device_type as _,
             device_id: ctx.device_id as i32,
         }
     }
index 0f3c775..d939949 100644 (file)
@@ -83,7 +83,7 @@ macro_rules! TVMPODValue {
                 use $name::*;
                 #[allow(non_upper_case_globals)]
                 unsafe {
-                    match type_code as i32 {
+                    match type_code as _ {
                         DLDataTypeCode_kDLInt => Int($value.v_int64),
                         DLDataTypeCode_kDLUInt => UInt($value.v_int64),
                         DLDataTypeCode_kDLFloat => Float($value.v_float64),