Improve Vec::truncate performance in no-opt builds

This significantly improves the performance of `Vec::truncate` for types
without destructors when building with `--opt-level=0` or `--opt-level=1`.
Fixes #17633.