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] [thread-next>] [day] [month] [year] [list]
Message-Id: <DCP44KG3HEKL.35ANJWT161W6M@kernel.org>
Date: Wed, 10 Sep 2025 14:18:12 +0200
From: "Benno Lossin" <lossin@...nel.org>
To: "Alice Ryhl" <aliceryhl@...gle.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>, "Andreas Hindborg" <a.hindborg@...nel.org>,
 "Trevor Gross" <tmgross@...ch.edu>, "Danilo Krummrich" <dakr@...nel.org>,
 "Tejun Heo" <tj@...nel.org>, "Tamir Duberstein" <tamird@...il.com>, "Dirk
 Behme" <dirk.behme@...il.com>, "Alban Kurti" <kurti@...icto.ai>, "Fiona
 Behrens" <me@...enk.dev>, <rust-for-linux@...r.kernel.org>,
 <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 2/2] rust: pin-init: add pin projections to
 `#[pin_data]`

On Wed Sep 10, 2025 at 12:54 PM CEST, Alice Ryhl wrote:
> On Wed, Sep 10, 2025 at 12:38 PM Benno Lossin <lossin@...nel.org> wrote:
>>
>> On Wed Sep 10, 2025 at 12:23 PM CEST, Alice Ryhl wrote:
>> > On Fri, Sep 5, 2025 at 7:12 PM Benno Lossin <lossin@...nel.org> wrote:
>> >> +    (make_pin_projections:
>> >> +        @vis($vis:vis),
>> >> +        @name($name:ident),
>> >> +        @impl_generics($($impl_generics:tt)*),
>> >> +        @ty_generics($($ty_generics:tt)*),
>> >> +        @decl_generics($($decl_generics:tt)*),
>> >> +        @where($($whr:tt)*),
>> >> +        @pinned($($(#[$($p_attr:tt)*])* $pvis:vis $p_field:ident : $p_type:ty),* $(,)?),
>> >> +        @not_pinned($($(#[$($attr:tt)*])* $fvis:vis $field:ident : $type:ty),* $(,)?),
>> >> +    ) => {
>> >> +        $crate::macros::paste! {
>> >> +            #[doc(hidden)]
>> >> +            $vis struct [< $name Projection >] <'__pin, $($decl_generics)*> {
>> >
>> > I'm not sure we want $vis here. That's the visibility of the original
>> > struct, but I don't think we want it to be pub just because the struct
>> > is.
>>
>> Why shouldn't it be pub if the original is pub? I don't really
>> understand the concern, since the fields themselves will still have the
>> correct visibility. Additionally, there is the `___pin_phantom_data`
>> field that's always private, so you cannot construct this outside of the
>> module.
>
> I mean, for instance, it's going to mean that every single struct that
> wraps Opaque in a private field will get a useless pub function called
> project that will appear in html docs.

It's `#[doc(hidden)]` :)

> Pin-project limits the visibility to pub(crate) when the struct is pub.

I think I would have to look inside the `vis` to recreate that behavior,
so I'd rather do it as a future patch. Thoughts?

---
Cheers,
Benno

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ