logoalt Hacker News

cyberaxtoday at 5:48 AM2 repliesview on HN

To be fair, Vec::set_len bug in Rust was in 2021. And even then it had to be annotated as `unsafe`. It was then deprecated and a linter check was added: https://github.com/rust-lang/rust-clippy/issues/7681


Replies

Dr_Emanntoday at 6:20 AM

To be even fair-er, it wasn't actually memory unsafety, it was "just" unsoundness, there was a type, that IF you gave it an io reader implementation that was weird, that implementation could see uninit data, or expose uninit data elsewhere, but the only readers actually used were well behaved readers.

orlptoday at 8:46 AM

Vec::set_len is by no means deprecated. The lint you linked only covers a very specific unsound pattern using set_len.

show 1 reply