[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z9gF90wPSZTRQfRR@pollux>
Date: Mon, 17 Mar 2025 12:22:31 +0100
From: Danilo Krummrich <dakr@...nel.org>
To: Tamir Duberstein <tamird@...il.com>
Cc: Andrew Ballance <andrewjballance@...il.com>,
Alice Ryhl <aliceryhl@...gle.com>, Miguel Ojeda <ojeda@...nel.org>,
Alex Gaynor <alex.gaynor@...il.com>,
Boqun Feng <boqun.feng@...il.com>, Gary Guo <gary@...yguo.net>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>,
Benno Lossin <benno.lossin@...ton.me>,
Andreas Hindborg <a.hindborg@...nel.org>,
Trevor Gross <tmgross@...ch.edu>, rust-for-linux@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] rust: alloc: add `Vec::dec_len`
On Sun, Mar 16, 2025 at 07:27:22PM -0400, Tamir Duberstein wrote:
>
> Does this suit?
I think for dec_ref() it is not the safety requrement that justifies the
invariant.
I think it should be something along the lines of:
// INVARIANT: We drop ownership for all elements within the range
// `[self.len - count, self.len]`, hence the updated value of `set.len`
// represents the exact number of elements stored within `self`.
>
> > // INVARIANT: By the safety requirements of this method `self.len - count` represents the
> > // exact number of elements stored within `self`.
Please do not use the email quote mechanism for code snippets, it's confusing
for readers to figure out by whom it has been written.
Powered by blists - more mailing lists