Skip to content

Commit

Permalink
ugh, lifetimes are broken again. this should at least compile once ru…
Browse files Browse the repository at this point in the history
  • Loading branch information
dwrensha committed Oct 26, 2014
1 parent 1656b93 commit 33ae99b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
1 change: 0 additions & 1 deletion compiler_tests/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -462,5 +462,4 @@ mod tests {
assert_eq!(new_version.get_new3().get_int8_field(), -123);
}
}

}
12 changes: 6 additions & 6 deletions src/capnp/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ pub trait MessageReader {
fn mut_arena<'a>(&'a mut self) -> &'a mut ReaderArena;
fn get_options<'a>(&'a self) -> &'a ReaderOptions;

fn get_root_internal<'a> (&'a self) -> any_pointer::Reader<'a> {
fn get_root_internal(&self) -> any_pointer::Reader<'static> {
unsafe {
let segment : *const SegmentReader = &self.arena().segment0;

Expand All @@ -65,7 +65,7 @@ pub trait MessageReader {
}
}

fn get_root<'a, T : layout::FromStructReader<'a>>(&'a self) -> T {
fn get_root<T : layout::FromStructReader<'static>>(&self) -> T {
self.get_root_internal().get_as_struct()
}

Expand Down Expand Up @@ -153,7 +153,7 @@ pub trait MessageBuilder {


// XXX is there a way to make this private?
fn get_root_internal<'a>(&mut self) -> any_pointer::Builder<'a> {
fn get_root_internal(&mut self) -> any_pointer::Builder<'static> {
let root_segment = &mut self.mut_arena().segment0 as *mut SegmentBuilder;

if self.arena().segment0.current_size() == 0 {
Expand All @@ -175,15 +175,15 @@ pub trait MessageBuilder {

}

fn init_root<'a, T : FromStructBuilder<'a> + HasStructSize>(&'a mut self) -> T {
fn init_root<T : FromStructBuilder<'static> + HasStructSize>(&mut self) -> T {
self.get_root_internal().init_as_struct()
}

fn get_root<'a, T : FromStructBuilder<'a> + HasStructSize>(&'a mut self) -> T {
fn get_root<T : FromStructBuilder<'static> + HasStructSize>(&mut self) -> T {
self.get_root_internal().get_as_struct()
}

fn set_root<'a, T : layout::ToStructReader<'a>>(&'a mut self, value : &T) {
fn set_root<T : layout::ToStructReader<'static>>(&mut self, value : &T) {
self.get_root_internal().set_as_struct(value);
}

Expand Down

0 comments on commit 33ae99b

Please sign in to comment.