logoalt Hacker News

100msyesterday at 11:08 PM2 repliesview on HN

What's the alternative?

https://play.rust-lang.org/?version=stable&mode=debug&editio...


Replies

zamadatixyesterday at 11:24 PM

.get() will bounds check and the compiler will optimize that away if it can prove safety at compile time. That leaves you 3 options made available in Rust:

- Explicitly unsafe

- Runtime crash

- Runtime crash w/ compile time avoidence when possible

omcnoeyesterday at 11:32 PM

https://play.rust-lang.org/?version=stable&mode=debug&editio...

Catch the panic & unwind, safe program execution continues. Fundamentally impossible in Fil-C.

show 2 replies