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]
Date: Sat, 04 May 2024 15:50:51 +0000
From: Benno Lossin <benno.lossin@...ton.me>
To: Alice Ryhl <aliceryhl@...gle.com>
Cc: Miguel Ojeda <ojeda@...nel.org>, Andrew Morton <akpm@...ux-foundation.org>, Alex Gaynor <alex.gaynor@...il.com>, Wedson Almeida Filho <wedsonaf@...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@...sung.com>, Marco Elver <elver@...gle.com>, Kees Cook <keescook@...omium.org>, Coly Li <colyli@...e.de>, Paolo Abeni <pabeni@...hat.com>, Pierre Gondois <pierre.gondois@....com>, Ingo Molnar <mingo@...nel.org>, Jakub Kicinski <kuba@...nel.org>, Wei Yang <richard.weiyang@...il.com>, Matthew Wilcox <willy@...radead.org>, linux-kernel@...r.kernel.org, rust-for-linux@...r.kernel.org
Subject: Re: [PATCH 1/9] rust: list: add ListArc

On 03.05.24 16:36, Alice Ryhl wrote:
> On Thu, Apr 4, 2024 at 4:00 PM Alice Ryhl <aliceryhl@...gle.com> wrote:
>>
>> On Wed, Apr 3, 2024 at 5:51 PM Benno Lossin <benno.lossin@...tonme> wrote:
>>>
>>> On 02.04.24 14:16, Alice Ryhl wrote:
>>>> +impl<T: ListArcSafe<ID>, const ID: u64> ListArc<T, ID> {
>>>> +    /// Constructs a new reference counted instance of `T`.
>>>> +    pub fn try_new(contents: T) -> Result<Self, AllocError> {
>>>> +        Ok(Self::from_unique(UniqueArc::try_new(contents)?))
>>>> +    }
>>>> +
>>>> +    /// Use the given initializer to in-place initialize a `T`.
>>>> +    ///
>>>> +    /// If `T: !Unpin` it will not be able to move afterwards.
>>>> +    pub fn pin_init<E>(init: impl PinInit<T, E>) -> error::Result<Self>
>>>> +    where
>>>> +        Error: From<E>,
>>>> +    {
>>>> +        Ok(Self::from_pin_unique(UniqueArc::pin_init(init)?))
>>>> +    }
>>>
>>> pin-init has a general trait for this: InPlaceInit. I don't know if the
>>> other functions that it provides would help you.
>>
>> I will use that.
> 
> Turns out it's not possible to use the trait in this case, for the
> same reasons as why Arc isn't using them either.

Ugh that is annoying, I think we can change `InPlaceInit` to have a
`PinnedSelf` associated type. I will create a good-first-issue.

-- 
Cheers,
Benno


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ