[PATCH v3 1/3] rust: error: Change `LayoutError` to internal

Jimmy Ostler posted 3 patches 1 year ago
There is a newer version of this series
[PATCH v3 1/3] rust: error: Change `LayoutError` to internal
Posted by Jimmy Ostler 1 year ago
Add an implementation of `From<LayoutError> for Error` for the
`kernel::alloc::layout::LayoutError`.
Remove the implementation on `core::alloc::LayoutError`, because we
don't use it anywhere.

Signed-off-by: Jimmy Ostler <jtostler1@gmail.com>
---
 rust/kernel/error.rs | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/rust/kernel/error.rs b/rust/kernel/error.rs
index 914e8dec1abd..f6ecf09cb65f 100644
--- a/rust/kernel/error.rs
+++ b/rust/kernel/error.rs
@@ -4,9 +4,10 @@
 //!
 //! C header: [`include/uapi/asm-generic/errno-base.h`](srctree/include/uapi/asm-generic/errno-base.h)
 
-use crate::{alloc::AllocError, str::CStr};
-
-use core::alloc::LayoutError;
+use crate::{
+    alloc::{layout::LayoutError, AllocError},
+    str::CStr,
+};
 
 use core::fmt;
 use core::num::NonZeroI32;
-- 
2.47.1
Re: [PATCH v3 1/3] rust: error: Change `LayoutError` to internal
Posted by Miguel Ojeda 1 year ago
On Wed, Dec 18, 2024 at 1:24 AM Jimmy Ostler <jtostler1@gmail.com> wrote:
>
> Add an implementation of `From<LayoutError> for Error` for the
> `kernel::alloc::layout::LayoutError`.
> Remove the implementation on `core::alloc::LayoutError`, because we
> don't use it anywhere.

No need to send a new version for this, but it may make sense to
reword to clarify that this switches the import, and therefore the
`impl` switches from one to the other. The way it is written, it
sounds like an actual `impl` item was textually added and another one
removed.

Cheers,
Miguel
Re: [PATCH v3 1/3] rust: error: Change `LayoutError` to internal
Posted by Danilo Krummrich 12 months ago
On Wed, Dec 18, 2024 at 01:57:29AM +0100, Miguel Ojeda wrote:
> On Wed, Dec 18, 2024 at 1:24 AM Jimmy Ostler <jtostler1@gmail.com> wrote:
> >
> > Add an implementation of `From<LayoutError> for Error` for the
> > `kernel::alloc::layout::LayoutError`.
> > Remove the implementation on `core::alloc::LayoutError`, because we
> > don't use it anywhere.
> 
> No need to send a new version for this, but it may make sense to
> reword to clarify that this switches the import, and therefore the
> `impl` switches from one to the other. The way it is written, it
> sounds like an actual `impl` item was textually added and another one
> removed.

Agree with Miguel, the commit message is slightly misleading.

With that fixed,

Acked-by: Danilo Krummrich <dakr@kernel.org>

> 
> Cheers,
> Miguel
Re: [PATCH v3 1/3] rust: error: Change `LayoutError` to internal
Posted by Jimmy Ostler 12 months ago
On Wed, Dec 18, 2024 at 4:43 AM Danilo Krummrich <dakr@kernel.org> wrote:
>
> On Wed, Dec 18, 2024 at 01:57:29AM +0100, Miguel Ojeda wrote:
> > On Wed, Dec 18, 2024 at 1:24 AM Jimmy Ostler <jtostler1@gmail.com> wrote:
> > >
> > > Add an implementation of `From<LayoutError> for Error` for the
> > > `kernel::alloc::layout::LayoutError`.
> > > Remove the implementation on `core::alloc::LayoutError`, because we
> > > don't use it anywhere.
> >
> > No need to send a new version for this, but it may make sense to
> > reword to clarify that this switches the import, and therefore the
> > `impl` switches from one to the other. The way it is written, it
> > sounds like an actual `impl` item was textually added and another one
> > removed.
>
> Agree with Miguel, the commit message is slightly misleading.

That's a good point, I can reword that.

> With that fixed,

I'll submit a v4 with that fixed, thanks.

> Acked-by: Danilo Krummrich <dakr@kernel.org>
>
> >
> > Cheers,
> > Miguel

Thanks,
Jimmy Ostler