| ▲ | orlp 2 hours ago | |
Vec::set_len is by no means deprecated. The lint you linked only covers a very specific unsound pattern using set_len. | ||
| ▲ | kibwen 2 hours ago | parent [-] | |
Indeed, and it doesn't need to be deprecated, because it's an API explicitly designed to give you low-level control where you need it, and because it is appropriately defined as an `unsafe` function with documented safety invariants that must be manually upheld in order for usage to be memory-safe. The documentation also suggests several other (safe) functions that should be used instead when possible, and provides correct usage examples: https://doc.rust-lang.org/std/vec/struct.Vec.html#method.set... . | ||