Thank you very much! I guess had better extend your "Borrowed pointers" 
tutorial with information about traits. At least for me it's unclear from the 
tutorial.

On Feb 2, 2013, at 9:08 AM, Niko Matsakis <[email protected]> wrote:

> You need "let (a, _) = *self" or "let &(a, _) = self".  self is a pointer to 
> a tuple, not a tuple.
> 
> 
> Niko
> 
> Alexander Stavonin wrote:
>> 
>> Thank you! But I still can not compile it:
>> 
>> 
>>   1 pub trait TupleVal<T> {
>>   2     pub pure fn _1(&self) -> &self/T;
>>   3     pub pure fn _2(&self) -> &self/T;
>>   4 }
>>   5 
>>   6 impl <T>(T, T): TupleVal<T> {
>>   7     pure fn _1(&self) -> &self/T {
>>   8         let (a, _) = self;                                               
>>                                                                
>>   9         a
>>  10     }
>>  11     pure fn _2(&self) -> &self/T {
>>  12         let (_, b) = self;
>>  13         b
>>  14     }
>>  15 }
>> 
>> test.rs:8:12: 8:18 error: mismatched types: expected `&self/('a,'a)`, found 
>> tuple
>> test.rs:8         let (a, _) = self;
>>                       ^~~~~~

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

Reply via email to