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

Kang Seonghoon someone at mearie.org
Sat Mar 29 06:37:52 PDT 2014

2014-03-29 21:53 GMT+09:00 Zoltán Tóth <zo1980 at gmail.com>:
> Use 'unsafe' everywhere?

Yes, using the `unsafe fn` in place of `fn` everywhere should be
sufficient. Actually it is not very hard to do so (before writing this
I have experimented with my own project for this strategy and it only
had a minor impact, but your mileage may vary) and if you want to
follow this path further you can build an alternative standard library
for unsafe uses *without changing the language itself*.

2014-03-29 21:53 GMT+09:00 Zoltán Tóth <zo1980 at gmail.com>:
> Devs, please explain how such option could decrease the safety of the language. As it would be just that, an option, an opt-in one.

Out-of-bound conditions are unsafe because they are well-known causes
of serious bugs (I seriously recommend the RISKS Digest for this
matter). We are well aware that there are other major causes of bugs
(e.g. interger overflow), but out-of-bound conditions are particularly
severe and deserves a solution. I would really appreciate better
solutions for the bounds check, but disabling the bounds check without
an alternative measure will considerably hurt the main goal of Rust.

-- Kang Seonghoon | Software Engineer, iPlateia Inc. | http://mearie.org/
-- Opinions expressed in this email do not necessarily represent the
views of my employer.

More information about the Rust-dev mailing list