On Fri, Aug 17, 2012 at 1:32 AM, Peter Hull <[email protected]> wrote:
> Just for my benefit, in Nathan's example:
>>
>> match myfoo {
>>   bar => /* ... stuff ... */
>> }
>>
> where bar is not an enum, is bar now an exact synonym for myfoo?
>
> If so, maybe the compiler could warn that you probably didn't want to
> do such a simple 1:1 binding? And maybe if you did want this binding,
> you could suppress the warning by putting (bar), which is reminiscent
> of a 1-element tuple, otherwise disallowed.
>

Yes, this is true, but it doesn't address the general problem:

match myfoo {
  [bar, 42] => /* ... */
}

I may have the rust syntax wrong, but the point is anywhere in a
structured/compound pattern either a variable binding or an enum
discriminator may appear, right?


> Pete


Nathan


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

Reply via email to