On 26.06.2014 00:04, Vadim Chugunov wrote:
> I wasn't thinking of subtyping u32w to u32.  I actually don't think that
> u32 should be convertible to u32w (or vice-versa) without an explicit
> cast.   For array slices, it would have to be a transmute-like function,
> e.g. fn as_wrapping<'a>(s:&'a [u32])->&'a [u32w] { unsafe { transmute(s) } }
> 
> 
FWIW, as I understand it RFC PR #91
<https://github.com/rust-lang/rfcs/pull/91> would nicely deal with such
cases, by making `u32` and `u32w` coercible. I don't think there is any
reason for `u32w` not to be just a newtype of `u32` with appropriate
arithmetic trait impls.
_______________________________________________
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to