[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CANiq72kTrfYzmgdLjOecsVTQzHdy_ZDaCO2KgbODtHpL0pS7Qw@mail.gmail.com>
Date: Tue, 17 Jan 2023 00:32:00 +0100
From: Miguel Ojeda <miguel.ojeda.sandonis@...il.com>
To: ojeda@...nel.org
Cc: Wedson Almeida Filho <wedsonaf@...il.com>,
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>,
rust-for-linux@...r.kernel.org, linux-kernel@...r.kernel.org,
patches@...ts.linux.dev, Josh Triplett <josh@...htriplett.org>
Subject: Re: [PATCH v1] rust: alloc: remove the `borrow` module (`ToOwned`, `Cow`)
On Tue, Dec 6, 2022 at 2:05 AM <ojeda@...nel.org> wrote:
>
> From: Miguel Ojeda <ojeda@...nel.org>
>
> The `Cow` type [1] requires that its generic parameter type implements
> the `ToOwned` trait [2], which provides a method to create owned data
> from borrowed data, usually by cloning.
>
> However, it is infallible, and thus in most cases it is not useful for
> the kernel. [3]
>
> Therefore, introduce `cfg(no_borrow)` to remove the `borrow` module
> (which contains `ToOwned` and `Cow`) from `alloc`.
>
> Link: https://doc.rust-lang.org/alloc/borrow/enum.Cow.html [1]
> Link: https://doc.rust-lang.org/alloc/borrow/trait.ToOwned.html [2]
> Link: https://lore.kernel.org/rust-for-linux/20221204103153.117675b1@GaryWorkstation/ [3]
> Cc: Gary Guo <gary@...yguo.net>
> Cc: Wedson Almeida Filho <wedsonaf@...il.com>
> Cc: Josh Triplett <josh@...htriplett.org>
> Signed-off-by: Miguel Ojeda <ojeda@...nel.org>
Applied to rust-next, thanks all!
Cheers,
Miguel
Powered by blists - more mailing lists