fix(vm): Fix warning about upcoming breaking change
`as` needs to have the types specified so fix that
@@ -198,7 +198,6 @@ impl<'vm> Deref for RootStr<'vm> {
}
}
-
struct Roots<'b> {
vm: GcPtr<Thread>,
stack: &'b Stack,
@@ -557,9 +556,7 @@ impl Thread {
// Finally check that type of the returned value is correct
let expected = T::make_type(self);
if check_signature(&*env, &expected, &actual) {
- unsafe {
- Ok(T::from_value(self, Variants::new(&value)))
- }
+ unsafe { Ok(T::from_value(self, Variants::new(&value))) }
} else {
Err(Error::WrongType(expected, actual.into_owned()))
}
@@ -650,10 +647,14 @@ impl Thread {
{
// For this to be safe we require that the received stack is the same one that is in this
// VM
+ {
+ let self_context: *const _ = &self.context;
+ let context: *const _ = context;
assert!(unsafe {
- context as *const _ as usize >= &self.context as *const _ as usize
- && context as *const _ as usize <= (&self.context as *const _).offset(1) as usize
+ context as usize >= self_context as usize
+ && context as usize <= self_context.offset(1) as usize
});
+ }
let roots = Roots {
vm: unsafe {
// Threads must only be on the garbage collectors heap which makes this safe
@@ -690,7 +691,6 @@ impl<'a> VmRoot<'a> for RootedThread {
}
}
-
/// Internal functions for interacting with threads. These functions should be considered both
/// unsafe and unstable.
pub trait ThreadInternal
@@ -711,7 +711,6 @@ where
where
T: VmRoot<'vm>;
-
/// Evaluates a zero argument function (a thunk)
fn call_thunk(&self, closure: GcPtr<ClosureData>) -> FutureValue<Execute<&Self>>;
@@ -1949,7 +1948,6 @@ where
binop(vm, stack, |l, r| Value::Tag(if f(l, r) { 1 } else { 0 }))
}
-
#[inline]
fn binop<'b, F, T>(vm: &'b Thread, stack: &mut StackFrame<'b>, f: F)
where
