3 ms·
let foo = [1, 2, 3]; unsafe { *foo.get_unchecked_mut(4) = 5; } Not sure why Rust evangelists always seem to ignore that unsafe exists.
by davemp 6mo ago
let foo = [1, 2, 3];
unsafe {
*foo.get_unchecked_mut(4) = 5;
}
Not sure why Rust evangelists always seem to ignore that unsafe exists.
- dendix 6mo agoHmmm... where could the oob access possibly be I can't tell
- davemp 6mo agoEasy to spot in a contrived example is not: > impossible to express in Rust I’m not going to argue with Rust folks who misrepresent the language.
- vmg12 6mo agoYou can prevent unsafe from being used in a repo with linter rules.