[rust-dev] Value may contain references; add `'static` bound to `I`

Matthew McPherrin mozilla at mcpherrin.ca
Mon Jun 9 01:35:38 PDT 2014


A boxed value must own its contents, thus the only type of reference they
may contain are 'static ones.

You should probably store an &'a Iterator instead, maybe, or a generic T:
Iterator


On Sun, Jun 8, 2014 at 7:33 PM, Gulshan Singh <gsingh_2011 at yahoo.com> wrote:

> I'm getting this error but I don't completely understand why: value may
> contain references; add `'static` bound to `I`. Here are the relevant
> snippets of code, I can add more if required:
> https://gist.github.com/gsingh93/ca7da693d98936dec10b
>
> The general idea is I have a Simulator object that stores a reference to
> an Automaton and a boxed Iterator<&I>, where I is the type that is input to
> the automaton. I have the `'a` lifetime on all of the references because I
> want them to have the same lifetime, so I don't know why it's telling me to
> add `'static`. I've asked about this in IRC, but I didn't get any response.
>
> _______________________________________________
> 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/20140609/6c6d91d3/attachment.html>


More information about the Rust-dev mailing list