3 ms·
Not comparing arrays longer than 32 elements by == sounds like a feature to me.
by xmprt 7y ago
Not comparing arrays longer than 32 elements by == sounds like a feature to me.
- millstone 7y agoThe 32-count cliff is not just for Eq - it also defeats niceties like Debug, Hash, Default. This isn't a deliberate design decision, it's due to a (current) limitation of Rust's value-type generics. The point is to illustrate that when you WTF using Rust, sometimes it's not you, it really is Rust.
- lumost 7y agoA great example of this can be seen writing any recursive data-structure such as a doubly linked list.
- ElderKorihor 7y agoI think there are a few places were Rust didn't get it quite right, but this seems like a weird example. The 32 length limit is a temporary limitation, not a corner that Rust is painted into. Indeed, my understanding is that the limitation at this point is being maintained artificially due to an overabundance of caution (via https://doc.rust-lang.org/std/array/trait.LengthAtMost32.html https://doc.rust-lang.org/std/array/trait.LengthAtMost32.htm... ). That's not WTF, that's just TODO.