diff --git a/ports/cef/wrappers.rs b/ports/cef/wrappers.rs index f1da9106df2..d8929352c84 100644 --- a/ports/cef/wrappers.rs +++ b/ports/cef/wrappers.rs @@ -36,6 +36,7 @@ use std::boxed; use std::collections::HashMap; use std::mem; use std::ptr; +use std::raw; pub trait CefWrap { fn to_c(rust_object: Self) -> CObject; @@ -196,8 +197,10 @@ impl<'a> CefWrap<*const cef_string_t> for &'a [u16] { } } unsafe fn to_rust(cef_string: *const cef_string_t) -> &'a [u16] { - let (ptr, len): (*mut c_ushort, uint) = ((*cef_string).str, (*cef_string).length as uint); - mem::transmute((ptr, len)) + mem::transmute(raw::Slice { + data: (*cef_string).str, + len: (*cef_string).length as usize, + }) } }