mirror of
https://github.com/servo/servo.git
synced 2025-08-04 13:10:20 +01:00
Fix the panic on runnig with --devtools due to a change in how type_id gets resolved since the last rustc upgrade.
This commit is contained in:
parent
1ac79c64da
commit
9242d1a1a3
1 changed files with 4 additions and 7 deletions
|
@ -16,7 +16,7 @@ use serialize::json;
|
||||||
/// A common trait for all devtools actors that encompasses an immutable name
|
/// A common trait for all devtools actors that encompasses an immutable name
|
||||||
/// and the ability to process messages that are directed to particular actors.
|
/// and the ability to process messages that are directed to particular actors.
|
||||||
/// TODO: ensure the name is immutable
|
/// TODO: ensure the name is immutable
|
||||||
pub trait Actor {
|
pub trait Actor : Any {
|
||||||
fn handle_message(&self,
|
fn handle_message(&self,
|
||||||
registry: &ActorRegistry,
|
registry: &ActorRegistry,
|
||||||
msg_type: &String,
|
msg_type: &String,
|
||||||
|
@ -45,12 +45,9 @@ impl<'a> AnyRefExt<'a> for &'a Actor + 'a {
|
||||||
fn is<T: 'static>(self) -> bool {
|
fn is<T: 'static>(self) -> bool {
|
||||||
// This implementation is only needed so long as there's a Rust bug that
|
// This implementation is only needed so long as there's a Rust bug that
|
||||||
// prevents downcast_ref from giving realistic return values.
|
// prevents downcast_ref from giving realistic return values.
|
||||||
unsafe {
|
let t = TypeId::of::<T>();
|
||||||
let t = TypeId::of::<T>();
|
let boxed: TypeId = (*self).get_type_id();
|
||||||
let this: &Actor = transmute(self);
|
t == boxed
|
||||||
let boxed: TypeId = this.get_type_id();
|
|
||||||
t == boxed
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn downcast_ref<T: 'static>(self) -> Option<&'a T> {
|
fn downcast_ref<T: 'static>(self) -> Option<&'a T> {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue