mirror of
https://github.com/servo/servo.git
synced 2025-08-04 13:10:20 +01:00
workaround for broken cross-crate generic newtype structs
add issue number for newtype struct issue
This commit is contained in:
parent
c804db0f93
commit
9df66ff021
2 changed files with 20 additions and 5 deletions
|
@ -58,13 +58,28 @@ pub fn BufferRequest(screen_rect: Rect<uint>, page_rect: Rect<f32>) -> BufferReq
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FIXME(rust#9155): this should be a newtype struct, but
|
||||||
|
// generic newtypes ICE when compiled cross-crate
|
||||||
#[deriving(Clone)]
|
#[deriving(Clone)]
|
||||||
pub struct RenderChan<T>{chan:SharedChan<Msg<T>>}
|
pub struct RenderChan<T> {
|
||||||
impl<T> RenderChan<T> {
|
chan: SharedChan<Msg<T>>,
|
||||||
pub fn new(chan: Chan<Msg<T>>) -> RenderChan<T> {
|
}
|
||||||
RenderChan{chan:SharedChan::new(chan)}
|
impl<T: Send> RenderChan<T> {
|
||||||
|
pub fn new(chan: Chan<Msg<T>>) -> RenderChan<T> {
|
||||||
|
RenderChan {
|
||||||
|
chan: SharedChan::new(chan),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl<T: Send> GenericChan<Msg<T>> for RenderChan<T> {
|
||||||
|
fn send(&self, msg: Msg<T>) {
|
||||||
|
assert!(self.try_send(msg), "RenderChan.send: render port closed")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl<T: Send> GenericSmartChan<Msg<T>> for RenderChan<T> {
|
||||||
|
fn try_send(&self, msg: Msg<T>) -> bool {
|
||||||
|
self.chan.try_send(msg)
|
||||||
}
|
}
|
||||||
pub fn send(&self, msg: Msg<T>) { self.chan.send(msg) }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct RenderTask<C,T> {
|
struct RenderTask<C,T> {
|
||||||
|
|
|
@ -438,7 +438,7 @@ impl Constellation {
|
||||||
if pipeline.subpage_id.expect("Constellation: child frame does not have a
|
if pipeline.subpage_id.expect("Constellation: child frame does not have a
|
||||||
subpage id. This should not be possible.") == subpage_id {
|
subpage id. This should not be possible.") == subpage_id {
|
||||||
child_frame_tree.rect = Some(rect.clone());
|
child_frame_tree.rect = Some(rect.clone());
|
||||||
let Rect { size: Size2D { width, height }, _ } = rect;
|
let Size2D { width, height } = rect.size;
|
||||||
pipeline.script_chan.send(ResizeMsg(pipeline.id.clone(), Size2D {
|
pipeline.script_chan.send(ResizeMsg(pipeline.id.clone(), Size2D {
|
||||||
width: width as uint,
|
width: width as uint,
|
||||||
height: height as uint
|
height: height as uint
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue