[PATCH v2 2/2] rust: init: remove old workaround

Tamir Duberstein posted 2 patches 5 months, 1 week ago
[PATCH v2 2/2] rust: init: remove old workaround
Posted by Tamir Duberstein 5 months, 1 week ago
`Error::from_errno` is `pub` since commit 5ed147473458 ("rust: error:
make conversion functions public"), thus remove this workaround which is
no longer needed.

Signed-off-by: Tamir Duberstein <tamird@gmail.com>
---
 rust/kernel/init.rs | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/rust/kernel/init.rs b/rust/kernel/init.rs
index f8402c818d30..9b3f3e29cc6a 100644
--- a/rust/kernel/init.rs
+++ b/rust/kernel/init.rs
@@ -79,14 +79,6 @@
 //! #     pub unsafe fn destroy_foo(_ptr: *mut foo) {}
 //! #     pub unsafe fn enable_foo(_ptr: *mut foo, _flags: u32) -> i32 { 0 }
 //! # }
-//! # // `Error::from_errno` is `pub(crate)` in the `kernel` crate, thus provide a workaround.
-//! # trait FromErrno {
-//! #     fn from_errno(errno: core::ffi::c_int) -> Error {
-//! #         // Dummy error that can be constructed outside the `kernel` crate.
-//! #         Error::from(core::fmt::Error)
-//! #     }
-//! # }
-//! # impl FromErrno for Error {}
 //! /// # Invariants
 //! ///
 //! /// `foo` is always initialized

-- 
2.50.0
Re: [PATCH v2 2/2] rust: init: remove old workaround
Posted by Miguel Ojeda 5 months ago
On Thu, Jul 10, 2025 at 12:49 AM Tamir Duberstein <tamird@gmail.com> wrote:
>
> `Error::from_errno` is `pub` since commit 5ed147473458 ("rust: error:
> make conversion functions public"), thus remove this workaround which is
> no longer needed.
>
> Signed-off-by: Tamir Duberstein <tamird@gmail.com>

This seems the same as this one applied a few weeks ago:

    https://lore.kernel.org/rust-for-linux/20250526152914.2453949-2-ojeda@kernel.org/

Cheers,
Miguel
Re: [PATCH v2 2/2] rust: init: remove old workaround
Posted by Benno Lossin 5 months ago
On Sun Jul 13, 2025 at 10:33 PM CEST, Miguel Ojeda wrote:
> On Thu, Jul 10, 2025 at 12:49 AM Tamir Duberstein <tamird@gmail.com> wrote:
>>
>> `Error::from_errno` is `pub` since commit 5ed147473458 ("rust: error:
>> make conversion functions public"), thus remove this workaround which is
>> no longer needed.
>>
>> Signed-off-by: Tamir Duberstein <tamird@gmail.com>
>
> This seems the same as this one applied a few weeks ago:
>
>     https://lore.kernel.org/rust-for-linux/20250526152914.2453949-2-ojeda@kernel.org/

Oh yeah you're right, thanks for the heads-up! (seems like I forgot the
patches after applying them so early in the cycle :)

---
Cheers,
Benno