Hacker News new | past | comments | ask | show | jobs | submit login

As author mentions, it is non-idiomatic Rust with lots of unsafe's, basically writing C code with Rust compiler.



This is not true. Unsafe only disables a few safety features. There are still a bunch left on so unsafe rust is still more safety checked than C.


Care to elaborate? What are such safety features?


The grandparent is wrong. Unsafe doesn't disable safety functions. From the big book of Rust Unsafety:

The only things that are different in Unsafe Rust are that you can:

- Dereference raw pointers

- Call unsafe functions (including C functions, compiler intrinsics, and the raw allocator)

- Implement unsafe traits

- Mutate statics

- Access fields of unions

https://doc.rust-lang.org/stable/nomicon/what-unsafe-does.ht...

The point is, unsafely calling `get_unchecked` is what's bypassing the range check feature. Not Unsafe itself.


The only unsafe functionality the author describes is the unchecked array access. Based on that (which may be incomplete, of course), the borrow checker is a safety feature that is active.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: