Re: [PATCH 3/5] rust: add pr_*_ratelimit! macros for printing

From: Gary Guo

Date: Tue Jun 23 2026 - 16:06:21 EST


On Tue Jun 23, 2026 at 8:53 PM BST, Miguel Ojeda wrote:
> On Tue, Jun 23, 2026 at 5:55 PM Gary Guo <gary@xxxxxxxxxxx> wrote:
>>
>> I really want this to be just a variant of pr_, not a entire new family of
>> macros.
>
> I think both approaches are fine. Personally I would like a `pr!`
> macro, but I am not convinced the advantages are big enough to drop
> the similitude/familiarity with C.

The previous proposal that I have on merging pr_ and dev_ macros (and add
implicit newline) is arguably not similar, but I think

pr_info_ratelimited(...)

is similar enough to both

pr_info_ratelimited!(...)

and

pr_info!(ratelimited, ...)

In C the second one is not doable due to expressivity limitation, but I think
our Rust macros shouldn't be restricted to be as expressive as C :)

(Also, even if we don't merge pr_ and dev_ print macros, we could still try to
unify the implementation so they share the same plumbing but different macro
entrypoint)

Best,
Gary

>
> It may be the kind of proposal that is best discussed in Kangrejos,
> LPC or similar in order to convince enough people and move it
> forward... :)
>
> Cheers,
> Miguel