Re: [PATCH v2 4/4] rust: Move register and bitstruct macros out of Nova
From: Joel Fernandes
Date: Mon Sep 08 2025 - 16:40:59 EST
On 9/8/2025 2:39 PM, Miguel Ojeda wrote:
> On Mon, Sep 8, 2025 at 7:06 PM Joel Fernandes <joelagnelf@xxxxxxxxxx> wrote:
>>
>> The issue I ran into is, without adding it to prelude, the users of register!
>> macro will have to import both bitfield! and register! macros explictly, even
>> though they're only using register!. I tried to make it work without adding to
>> prelude, but couldn't:
>>
>> use kernel::{bitfield, register};
>>
>> Also not adding it to prelude, means register! macro has to invoke bitfield with
>> $crate prefixed ($crate::bitfield).
>
> I am not sure I follow -- macros should use qualified paths in general
> so that they assume as little as possible from the calling
> environment.
>
> It should work without the prelude -- what didn't work?
Ah, I guess my intent was to not use the qualified path. But that's better than
the users having to import prelude. Ok, thanks! - I will try this out.
- Joel
>
> Thanks!
>
> Cheers,
> Miguel