workaround for broken cross-crate generic newtype structs

add issue number for newtype struct issue
This commit is contained in:
Tim Kuehn 2013-09-20 00:13:10 -04:00
parent c804db0f93
commit 9df66ff021
2 changed files with 20 additions and 5 deletions

View file

@ -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)]
pub struct RenderChan<T>{chan:SharedChan<Msg<T>>}
impl<T> RenderChan<T> {
pub fn new(chan: Chan<Msg<T>>) -> RenderChan<T> {
RenderChan{chan:SharedChan::new(chan)}
pub struct RenderChan<T> {
chan: SharedChan<Msg<T>>,
}
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> {

View file

@ -438,7 +438,7 @@ impl Constellation {
if pipeline.subpage_id.expect("Constellation: child frame does not have a
subpage id. This should not be possible.") == subpage_id {
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 {
width: width as uint,
height: height as uint