"if it compiles, it works!"

gems

>complains about how C++ is better because you need to know how to write safe code
>writes unsafe code in Rust immediately

user... maybe programming isn't for you

Attached: 999.jpg (758x644, 37.75K)

yeah, I've only written a bit of rust but I thought OP's example should be caught by the compiler..? what's the issue

that's a lot of words that you could have instead used to show how that breaks memory unsafety

>fails at basic static analysis and needs to rely on runtime checks
go compile C code with `-fsanitize=address`
CONGRATZ, now C is memory safe as well.

>this compiles without any warning
I mean, why shouldn't it, it's still memory-safe at runtime

I bet that e-mail probably went right over your head. Do you understand the underlying issue here, aka memory overcommitment?

Rust does catch this. Select "Tools" then "Clippy" from the dropdown in the upper left. You should always have Clippy enabled.

play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=0c2123e51412b14e5fe08867c74116b7

```
Checking playground v0.0.1 (/playground)
error: range is out of bounds
--> src/main.rs:10:27
|
10 | analyze_slice(&arr[0..5]); // this compiles without any warning
| ^
|
= note: `#[deny(clippy::out_of_bounds_indexing)]` on by default
= help: for further information visit rust-lang.github.io/rust-clippy/master/index.html#out_of_bounds_indexing

error: could not compile `playground` due to previous error
```

Clippy detects it, but not the actual compiler for whatever reason.

This