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: <DCMW6H0VJ9AP.1XWI1RI9YWO9H@kernel.org>
Date: Sun, 07 Sep 2025 23:39:13 +0200
From: "Danilo Krummrich" <dakr@...nel.org>
To: "Benno Lossin" <lossin@...nel.org>
Cc: "Boqun Feng" <boqun.feng@...il.com>, "Miguel Ojeda" <ojeda@...nel.org>,
 "Alex Gaynor" <alex.gaynor@...il.com>, "Gary Guo" <gary@...yguo.net>,
 Björn Roy Baron <bjorn3_gh@...tonmail.com>, "Andreas
 Hindborg" <a.hindborg@...nel.org>, "Alice Ryhl" <aliceryhl@...gle.com>,
 "Trevor Gross" <tmgross@...ch.edu>, "Fiona Behrens" <me@...enk.dev>, "Alban
 Kurti" <kurti@...icto.ai>, "Greg Kroah-Hartman"
 <gregkh@...uxfoundation.org>, "Rafael J. Wysocki" <rafael@...nel.org>,
 "Bjorn Helgaas" <bhelgaas@...gle.com>,
 Krzysztof Wilczy´nski <kwilczynski@...nel.org>,
 <rust-for-linux@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] rust: pin-init: add references to previously
 initialized fields

On Sun Sep 7, 2025 at 11:06 PM CEST, Benno Lossin wrote:
> On Sun Sep 7, 2025 at 7:29 PM CEST, Danilo Krummrich wrote:
> I have some ideas of changing the syntax to be more closure-esque:
>
>     init!(|this| -> Result<MyStruct, Error> {
>         let x = 42;
>         MyStruct {
>             x,
>         }
>     })
>
> There we could add another parameter, that would then serve this
> purpose. We should also probably rename `this` to `slot` & then use
> `this` for the initialized version.

I think that's a pretty good idea, but the part that I think is a little bit
confusing remains: `this` will need to have different fields depending on where
it's accessed.

> But as I said before, implementing the `this` thing from a macro
> perspective is rather difficult (I have two ideas on how to do it and
> both are bad...).
>
>> But as you say, that sounds tricky to implement and is probably not very
>> intuitive either. I'd rather say keep it as it is, if we don't want something
>> like the `let b <- b` syntax I proposed for formatting reasons.
>
> I don't feel like that's conveying the correct thing, it looks as if you
> are only declaring a local variable.

Yeah, it's not great, but given that it's a custom syntax it also does not
create wrong expectations I'd say.

Anyways, I'm fine with either. For now we probably want to land the version as
it is and revisit once you settle on the syntax rework you mentioned above.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ