[rust-dev] Question about lifetime analysis (a 0.5 transition question)

Steve Jenson stevej at fruitless.org
Sun Dec 23 17:05:47 PST 2012

That explanation makes sense, it seems like the lifetime analysis improved
from 0.4 (where this code worked) to 0.5?

Since it seems that you can't use borrowed pointers to shared heap items in
an arglist, I went ahead and created a new type of iter called BareIter.

trait BareIter<A> {
  pure fn each(&self, blk: fn(v: A) -> bool);

and converted my use of BaseIter to BareIter.

On Sat, Dec 22, 2012 at 10:42 AM, Lucian Branescu <lucian.branescu at gmail.com
> wrote:

> I think the problem is the compiler can't guarantee the managed box will
> survive, so it won't allow a borrowed pointer.
> I think there are problems in general with @ and borrowing.
>  I've converted the red-black tree I wrote to use iter::BaseIter but am
> now fighting with lifetime analysis with the switch to 0.5.
> https://github.com/stevej/rustled/blob/master/red_black_tree.rs#L91
> And the error I'm getting with 0.5 is:
> http://pastebin.com/YK8v7EdA
> I've read the docs on lifetimes several times now but it's not quite
> enough to get me over this hurdle.
> Thanks!
> Steve
> _______________________________________________
> Rust-dev mailing list
> Rust-dev at mozilla.org
> https://mail.mozilla.org/listinfo/rust-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/rust-dev/attachments/20121223/b5c1b2c5/attachment.html>

More information about the Rust-dev mailing list