This code compiles successfully: http://ix.io/a34 . I believe this behavior is correct. Just so it's clear what this code does: f() takes a `&mut int` and adds it to an array - the idea is that all of the `&mut int` can be changed at some later time. Naturally, there's some fancy lifetime juggling involved in this (which I may have gotten wrong).

Uncommenting the commented parts (the method f() in the impl A, in particular) yields the error message shown at the bottom, which appears to say that the lifetime created in the second parameter of f() does not necessarily outlive itself.

Is there some especially complicated aspect of lifetimes as they interact with &self, or is this indeed a bug?

--
Scott Lawrence
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to