Re: [rust-dev] Cap'n Proto and region variables

2013-07-26 Thread Erick Tryzelaar
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


Re: [rust-dev] Cap'n Proto and region variables

2013-07-26 Thread Erick Tryzelaar
Yep, you are right. I think this is going to need #7331 fixed to work for
you.


On Fri, Jul 26, 2013 at 10:28 AM, David Renshaw dwrens...@gmail.com wrote:

 I don't think that workaround helps in my case. The next thing I want
 is a struct:

 struct SegmentReader'self { data : 'self [u8] }

 which implements `Constructable`. None of the following compile
 successfully:


 impl 'self Constructable for SegmentReader'self {
 fn construct(v : 'self [u8]) - SegmentReader'self {
 SegmentReader { data : v }
 }
 }


 impl 'self Constructable for SegmentReader'self {
 fn construct'self(v : 'self [u8]) - SegmentReader'self {
 SegmentReader { data : v }
 }
 }


 impl 'self Constructable for SegmentReader'self {
 fn construct'a(v : 'a [u8]) - SegmentReader'a {
 SegmentReader { data : v }
 }
 }



 On Fri, Jul 26, 2013 at 12:32 PM, Erick Tryzelaar
 erick.tryzel...@gmail.com wrote:
  ... 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


Re: [rust-dev] Cap'n Proto and region variables

2013-07-24 Thread Niko Matsakis
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


Re: [rust-dev] Cap'n Proto and region variables

2013-07-24 Thread David Renshaw
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