Skip to content

Commit

Permalink
fix(vm): Fix warning about upcoming breaking change
Browse files Browse the repository at this point in the history
`as` needs to have the types specified so fix that
  • Loading branch information
Marwes committed Dec 30, 2017
1 parent 1326ca5 commit 3918f66
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions vm/src/thread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,6 @@ impl<'vm> Deref for RootStr<'vm> {
}
}


struct Roots<'b> {
vm: GcPtr<Thread>,
stack: &'b Stack,
Expand Down Expand Up @@ -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()))
}
Expand Down Expand Up @@ -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
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
});
{
let self_context: *const _ = &self.context;
let context: *const _ = context;
assert!(unsafe {
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
Expand Down Expand Up @@ -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
Expand All @@ -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>>;

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 3918f66

Please sign in to comment.