... and I just found a workaround for you:

trait Constructable { fn construct<'a>(v : &'a [u8]) -> Self; }
fn main() { }

Compiles fine for me.



On Fri, Jul 26, 2013 at 9:30 AM, Erick Tryzelaar
<erick.tryzel...@gmail.com>wrote:

> David: That error seems pretty similar to this one (
> https://github.com/mozilla/rust/issues/7331), so I added your code as
> another example.
>
>
> On Wed, Jul 24, 2013 at 4:26 PM, David Renshaw <dwrens...@gmail.com>wrote:
>
>> Looks like it's broken at the moment. If I try to compile this program:
>>
>> trait Constructable<'self> { fn construct(v : &'self[u8]) -> Self; }
>> fn main() { }
>>
>> I get this error:
>>
>> error: internal compiler error: ty::Region#subst(): Reference to self
>> region when given substs with no self region: substs(self_r=None,
>> self_ty=Some(BUG[0]), tps=[])
>>
>> On Wed, Jul 24, 2013 at 9:09 AM, Niko Matsakis <n...@alum.mit.edu> wrote:
>> > On Sun, Jul 21, 2013 at 12:44:24PM -0400, David Renshaw wrote:
>> >> Hello everyone,
>> >>
>> >> I'm playing around with a Rust implementation for Cap'n Proto. Check
>> >> it out: http://github.com/dwrensha/capnproto-rust . I welcome any
>> >> comments or contributions.
>> >>
>> >> The reason I'm sharing this project with you now is I'd like to ask
>> >> about a language feature missing from Rust that I feel may be
>> >> hindering my progress.
>> >>
>> >> To the point, I want to be able define a trait like this:
>> >>
>> >> trait Constructable<'self> {
>> >>    fn construct<'a>(StructReader<'a>) -> Self<'a>;
>> >> }
>> >
>> > I believe it would it be possible to define the trait like so:
>> >
>> >     trait Constructable<'self> {
>> >         fn construct(StructReader<'self>) -> Self;
>> >     }
>> >
>> >
>> >
>> > regards,
>> >
>> > Niko
>> _______________________________________________
>> Rust-dev mailing list
>> Rust-dev@mozilla.org
>> https://mail.mozilla.org/listinfo/rust-dev
>>
>
>
_______________________________________________
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to