Re: [PATCH v2 2/2] rust: alloc: fix `Vec::extend_with` SAFETY comment
From: Miguel Ojeda
Date: Sun Apr 26 2026 - 09:10:59 EST
On Sat, Apr 25, 2026 at 12:18 PM Hsiu Che Yu
<yu.whisper.personal@xxxxxxxxx> wrote:
>
> Fix an incorrect operator in the SAFETY comment, changing `<` to `<=`,
> since `Vec::reserve` guarantees capacity for exactly n additional elements,
> so the equal case should be included.
>
> Signed-off-by: Hsiu Che Yu <yu.whisper.personal@xxxxxxxxx>
Thanks!
For this case it doesn't matter too much, but in general, when
something is a fix, we add a Fixes: tag (and in most cases Cc: stable@
to accompany it). That helps backporting (when needed), adds context
e.g. for reviewing (at times), etc.
By the way, now that I was looking at `reserve()`, the assert in the
example there should probably use `>= 11` since there is already an
element, instead of `>= 10`. That could be another similar patch.
Cheers,
Miguel