[rust-dev] Compiling with no bounds checking for vectors?

Tommi Tissari rusty.gates at icloud.com
Thu Mar 27 18:02:57 PDT 2014

Compiling with that flag would figuratively speaking wrap everything inside an unsafe block and then omit vector bounds checking. The flag wouldn't be allowed for library builds.

What I find a bit totalitarian about this situation is that the language forces a decision which the programmer should be allowed to make for himself. A bit like someone dictating my hair style.

> On 28 Mar 2014, at 02:05, Daniel Micay <danielmicay at gmail.com> wrote:
>> On 27/03/14 04:42 PM, Tommi wrote:
>>> A flag that removes safety is pretty antithical to the goals of the
>>> language, IMHO.
>> Yes, I agree it's not the official Rust way of things. But not providing the option seems quite totalitarian. An example use case might be a company that runs its code on 100,000 servers, and has do so for many years without a hiccup. They realize they could save millions of dollars a year in electricity bill by disabling bounds checking, and that's what they decide to do. At this point they would really like to have that compiler flag.
> Rust already provides unchecked indexing. You're free to make use of it
> whenever you want. It makes zero sense to disable the bounds checks for
> the index operators that are considered safe. What does the unsafe
> keyword even mean for a project using that flag? Just because something
> is *possible* does not somehow make it "totalitarian" to not support it.
> Rust should not add flags creating incompatible dialects of the
> language, and that's exactly what this would do.

More information about the Rust-dev mailing list