lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Z86P1Er_D8UACOQ9@mango>
Date: Mon, 10 Mar 2025 07:08:12 +0000
From: Oliver Mangold <oliver.mangold@...me>
To: Miguel Ojeda <miguel.ojeda.sandonis@...il.com>
Cc: 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>, Alice Ryhl <aliceryhl@...gle.com>, Trevor Gross <tmgross@...ch.edu>, Asahi Lina <lina@...hilina.net>, rust-for-linux@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v5 4/4] rust: adding OwnableRefCounted and SimpleOwnableRefCounted

On 250307 1416, Miguel Ojeda wrote:
> Hi Oliver,
> 
> Some general style nits for this and other series you may send in the
> future (not a review). Please note that most may apply several times.
> 
> On Fri, Mar 7, 2025 at 11:04 AM Oliver Mangold <oliver.mangold@...me> wrote:
> >
> > Types implementing one of these traits
> > can safely convert between an ARef<T> and an Owned<T>.
> 
> The wrapping is strange here, and it also happens in your code
> comments. Please use the same width as the rest of the code in a file
> etc.
>

Sure, I can change that, no problem. Just to explain, I didn't give that
too much thought. I just tried to stick to the 100 chars max length.
I think I tended to try to split lines at places where it fits the
sentence structure to improve readability, but I guess you are right,
using up the maximum space is easier to the deal with

> > +/// - The same safety requirements as for [`Ownable`] and [`RefCounted`] apply.
> I wonder if we should expand/inline them, even if they come from the
> supertraits.
>

I tried to avoid copy-paste, but I can do if it is generally preferred.
Or can rustdoc include sections?

> > +/// - the uniqueness invariant of [`Owned`] is upheld until dropped.
> 
> Please use uppercase to start sentences.
>

Ok. I think I mostly did, but seems I missed a few.

> 
> "same" sounds like no extra requirements -- what about something like:
> 
>     The safety requirements from both [.....
>

> > +///         // Use a KBox to handle the actual allocation
> 
> Please use Markdown for comments too, and period at the end (also for
> "SAFETY: ..." comments).
> 
> > +/// // SAFETY: we implement the trait correctly by ensuring
> 
> There is no need to say "we implement the trait correctly", i.e. the
> `SAFETY` tag is enough to introduce the comment; the same way we don't
> say "SAFETY: the following unsafe block is correct because ..." etc.
>

> > +///     }
> > +///     fn is_unique(&self) -> bool {
> 
> Newline between items.
> 
> > +/// let foo = Foo::new().unwrap();
>

> In general, we try to avoid showing patterns that people should avoid
> when writing actual code (at least in non-hidden code) -- could we
> avoid the `unwrap()`?

Sure, I will fix all of the above in the next release.

> > +// TODO: enable this when compiler supports it (>=1.85)
> > +// #[diagnostic::do_not_recommend]
>

On 250309 2247, Miguel Ojeda wrote:
> 
> Oliver: I am sending a quick patch explaining this -- please feel free
> to pick it up in your series.

Thanks. I agree it is better not having to change this after compiler upgrade.

Best regards,

Oliver


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ