[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <D8LU2SGJ1T4U.1JPJWNV09A5UT@proton.me>
Date: Fri, 21 Mar 2025 09:23:51 +0000
From: Benno Lossin <benno.lossin@...ton.me>
To: Alice Ryhl <aliceryhl@...gle.com>
Cc: Danilo Krummrich <dakr@...nel.org>, rust-for-linux@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/5] rust: alloc: add Vec::pop
On Fri Mar 21, 2025 at 8:44 AM CET, Alice Ryhl wrote:
> On Thu, Mar 20, 2025 at 10:11:09PM +0000, Benno Lossin wrote:
>> On Thu Mar 20, 2025 at 2:52 PM CET, Alice Ryhl wrote:
>> > +
>> > + // INVARIANT: If the first `len` elements are valid, then the first `len-1` elements are
>>
>> Please add spaces around `-`.
>
> I can do that, but does it really read better?
That's how rustfmt would format it and I do think it improves
readability for me.
>> > + // valid.
>> > + self.len = len_sub_1;
>> > +
>> > + // INVARIANT: This invalidates a value in this vector's allocation, but the Vec invariants
>> > + // do not require it to be valid because `self.len <= len_sub_1`.
>>
>> I don't think this should be an `INVARIANT` comment. Maybe we don't even
>> need it.
>
> I can drop the INVARIANT: prefix.
Sounds good.
---
Cheers,
Benno
Powered by blists - more mailing lists