Re: [PATCH v1 23/28] rust: std_vendor: add `dbg!` macro based on `std`'s one

Boqun Feng
2022-11-10T19:16:19Z

On Thu, Nov 10, 2022 at 08:14:17PM +0100, Miguel Ojeda wrote:
> On Thu, Nov 10, 2022 at 7:02 PM Boqun Feng <boqun.feng@gmail.com> wrote:
> >
> > and I'm almost convinced ;-) Better add the gist of discussion into
> > comment/document/commit log? Users need to know when to use `dbg!` and
> > when to use `pr_debug!`, right?
>
> The docs talk about it a bit:
>
> +/// Note that the macro is intended as a debugging tool and therefore you
> +/// should avoid having uses of it in version control for long periods
> +/// (other than in tests and similar).
>
> That is the original wording from the standard library, but we can
> definitely make the rules more concrete on our end with something

Yeah, having some kernel contexts is better ;-)

> like:
>
> `dbg!` is intended as a temporary debugging tool to be used during
> development. Therefore, avoid committing `dbg!` macro invocations
> into the kernel tree.
>
> For debug output that is intended to be kept, use `pr_debug!` and
> similar facilities instead.
>

Look good to me, thank you!

Regards,
Boqun

> Cheers,
> Miguel