qemu-rust
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] rust: restrict missing_const_for_fn to qemu_api crate


From: Stefan Hajnoczi
Subject: Re: [PATCH] rust: restrict missing_const_for_fn to qemu_api crate
Date: Mon, 10 Feb 2025 09:06:12 -0500

On Fri, Feb 7, 2025 at 9:40 AM Paolo Bonzini <pbonzini@redhat.com> wrote:
>
> missing_const_for_fn is not necessarily useful or good.  For example in
> a private API you can always add const later, and in a public API
> it can be unnecessarily restrictive to annotate everything with const
> (blocking further improvements to the API).
>
> Nevertheless, QEMU turns it on because qemu_api uses const quite
> aggressively and therefore it can be handy to have as much as possible
> annotated with const.  Outside qemu_api though, not so much: devices
> are self contained consumers and if there is nothing that could use
> their functions in const contexts that were not anticipated.
>
> Since missing_const_for_fn can be a bit noisy and trigger on trivial
> functions that no one would ever call in const context, do not
> turn it on everywhere and only keep it in qemu_api as a special case.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]