Re: [PATCH] rust: init: change the generated name of guard variables

From: Alice Ryhl
Date: Thu Apr 04 2024 - 08:39:42 EST


On Wed, Apr 3, 2024 at 9:43 PM Benno Lossin <benno.lossin@xxxxxxxxx> wrote:
>
> The initializers created by the `[try_][pin_]init!` macros utilize the
> guard pattern to drop already initialized fields, when initialization
> fails mid-way. These guards are generated to have the same name as the
> field that they handle. To prevent namespacing issues when the field
> name is the same as e.g. a constant name, add `__` as a prefix and
> `_guard` as the suffix.
>
> Signed-off-by: Benno Lossin <benno.lossin@xxxxxxxxx>

Reviewed-by: Alice Ryhl <aliceryhl@xxxxxxxxxx>