[rust-dev] Confused about the precedence of 'as' operator

2014-05-30 Thread Tommi
The manual says that the precedence of `as` operator is lower than that of the binary `*` operator. Thus I would not expect the following to compile (but it does): let a: u16 = 1; let b: u32 = 2; let r = a * b as u16; Since multiplication is supposed to have precedence over casting, I would

Re: [rust-dev] Confused about the precedence of 'as' operator

2014-05-30 Thread Benjamin Striegel
The manual also says that `as` somehow has a lower precedence than `*` and yet a higher precedence than `+`, which would be hilarious madness. Don't trust the manual. On Fri, May 30, 2014 at 11:02 AM, Tommi rusty.ga...@icloud.com wrote: The manual says that the precedence of `as` operator is

Re: [rust-dev] Confused about the precedence of 'as' operator

2014-05-30 Thread Andrew Poelstra
I did not know that the manual agrees with me, but I've noticed the existing behaviour and find it very unintuitive. Andrew On Fri, May 30, 2014 at 06:02:51PM +0300, Tommi wrote: The manual says that the precedence of `as` operator is lower than that of the binary `*` operator. Thus I

Re: [rust-dev] Confused about the precedence of 'as' operator

2014-05-30 Thread Patrick Walton
On 5/30/14 8:02 AM, Tommi wrote: The manual says that the precedence of `as` operator is lower than that of the binary `*` operator. Thus I would not expect the following to compile (but it does): let a: u16 = 1; let b: u32 = 2; let r = a * b as u16; Since multiplication is supposed to have

Re: [rust-dev] Confused about the precedence of 'as' operator

2014-05-30 Thread Steve Klabnik
Yup. The manual should not be trusted. We'll fix it! ___ Rust-dev mailing list Rust-dev@mozilla.org https://mail.mozilla.org/listinfo/rust-dev