From 9242d1a1a3bfb15983e39307f6224712c8c07dd8 Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Sat, 29 Nov 2014 00:17:35 -0500 Subject: [PATCH] Fix the panic on runnig with --devtools due to a change in how type_id gets resolved since the last rustc upgrade. --- components/devtools/actor.rs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/components/devtools/actor.rs b/components/devtools/actor.rs index 2d15134ec37..0643b567f52 100644 --- a/components/devtools/actor.rs +++ b/components/devtools/actor.rs @@ -16,7 +16,7 @@ use serialize::json; /// A common trait for all devtools actors that encompasses an immutable name /// and the ability to process messages that are directed to particular actors. /// TODO: ensure the name is immutable -pub trait Actor { +pub trait Actor : Any { fn handle_message(&self, registry: &ActorRegistry, msg_type: &String, @@ -45,12 +45,9 @@ impl<'a> AnyRefExt<'a> for &'a Actor + 'a { fn is(self) -> bool { // This implementation is only needed so long as there's a Rust bug that // prevents downcast_ref from giving realistic return values. - unsafe { - let t = TypeId::of::(); - let this: &Actor = transmute(self); - let boxed: TypeId = this.get_type_id(); - t == boxed - } + let t = TypeId::of::(); + let boxed: TypeId = (*self).get_type_id(); + t == boxed } fn downcast_ref(self) -> Option<&'a T> {