[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANiq72k6Vv2L+q9iV6Djx1=VGYCANegOLb_Kp-yMscMgYzvfRw@mail.gmail.com>
Date: Tue, 19 Mar 2024 12:24:16 +0100
From: Miguel Ojeda <miguel.ojeda.sandonis@...il.com>
To: Benno Lossin <benno.lossin@...ton.me>
Cc: Laine Taffin Altman <alexanderaltman@...com>, Boqun Feng <boqun.feng@...il.com>,
Miguel Ojeda <ojeda@...nel.org>, Alex Gaynor <alex.gaynor@...il.com>,
Wedson Almeida Filho <wedsonaf@...il.com>, Gary Guo <gary@...yguo.net>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>,
Andreas Hindborg <a.hindborg@...sung.com>, Alice Ryhl <aliceryhl@...gle.com>,
Martin Rodriguez Reboredo <yakoyoku@...il.com>, stable@...r.kernel.org, rust-for-linux@...r.kernel.org,
lkml <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] rust: init: remove impl Zeroable for Infallible
On Tue, Mar 19, 2024 at 11:34 AM Benno Lossin <benno.lossin@...ton.me> wrote:
>
> I can re-send it for you again, or do you want to send it yourself?
> I think it is also a good idea to add a link to [1] in the code, since
> the above explanation is rather long and fits better in the commit
> message.
Agreed, if you want to have a note in the code itself (to avoid
mistakes re-adding them, I imagine), then I would say a short sentence
+ link is best.
Your link is a good one for an explanation, since it mentions
explicitly the UB. The reference's list [1] would be a good fit for
non-explanation purposes -- it mentions explicitly `!` (and
`Infallible` is supposed to eventually be an alias as far as I know).
In addition, while it is not important in this case (i.e. most likely
nobody is affected), it doesn't hurt to include an example that shows
the issue in general for this sort of patches, i.e. what kind of code
will be prevented from compiling, e.g.
pr_info!("{}",
Box::<core::convert::Infallible>::init(kernel::init::zeroed())?);
In any case, even v1 looks good to me -- thanks!
[1] https://doc.rust-lang.org/reference/behavior-considered-undefined.html
Cheers,
Miguel
Powered by blists - more mailing lists