Re: [PATCH v5 04/26] rust: alloc: implement `Allocator` for `Kmalloc`

Danilo Krummrich
2024-08-14T15:20:11Z

On Wed, Aug 14, 2024 at 05:03:21PM +0200, Miguel Ojeda wrote:
> On Wed, Aug 14, 2024 at 4:00 PM Danilo Krummrich <dakr@kernel.org> wrote:
> >
> > If we keep them, we'd consequently also need to add them for vrealloc() and
> > kvrealloc(). But again, they don't do anything for us, and hence are more
> > misleading than helpful IMO.
>
> In general, they could do something (e.g. `noreturn`), perhaps in the future.

Indeed, and I think once they're honored we should add them again.

It's just that I think as long as compiler attributes aren't honored, we should
not have them in the first place to avoid confusion about whether they do or do
not have any effect.

>
> Apart from being potentially misleading, do we gain something by
> removing them?

It's not so much that I want to remove them for krealloc(), it's that I don't
want to intentionally add them for the vrealloc() and kvrealloc() helpers,
knowing that they don't do anything (yet).

And I think it's even more confusing if the krealloc() helper has those compiler
attributes, but the vrealloc() and kvrealloc() helpers do not.

> I guess simplicity in the file, but it is also simpler
> to keep them aligned to the C side (which I guess is Alice's point),
> and avoids having to keep track of what could have a present or future
> impact in `bindgen`.
>
> Cheers,
> Miguel
>