[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ODNG_IK--F-9@tuta.io>
Date: Thu, 5 Dec 2024 20:22:46 +0100 (CET)
From: jens.korinth@...a.io
To: Miguel Ojeda <miguel.ojeda.sandonis@...il.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>,
Benno Lossin <benno.lossin@...ton.me>,
Andreas Hindborg <a.hindborg@...nel.org>,
Alice Ryhl <aliceryhl@...gle.com>, Trevor Gross <tmgross@...ch.edu>,
Rust For Linux <rust-for-linux@...r.kernel.org>,
FUJITA Tomonori <fujita.tomonori@...il.com>,
Dirk Behme <dirk.behme@...il.com>,
Linux Kernel <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v4 3/3] rust: error: Replace pr_warn by pr_warn_once
> Sorry, I am confused. This is not implementing the `From` trait, it is
> an inherent implementation.
Hmm, you're right. I assume there is a reason why it doesn't implement
`From<c_int>` or `TryFrom<c_int>`?
> If what you mean is that this should not be an infallible operation,
> then we are back at my previous reply, i.e. are you suggesting to
> remove the method? Could you please clarify, perhaps with an example?
Yes, I meant to say it should not be infallible, because, well, it isn't. :)
I'd probably make `try_from_errno` public and remove `from_errno`.
If there's no other disadvantage I'd remove `try_from_errno` as well and
replace it by `TryFrom<c_int>`. Implementing `From<Error> for c_int` may
also make sense for the other direction?
Jens
Powered by blists - more mailing lists