Re: [PATCH v1] rust: bug: prevent dead_code warning from warn_on!'s flags constant
FUJITA Tomonori <[email protected]>
| Newsgroups | org.kernel.vger.rust-for-linux |
|---|---|
| Message-ID | <[email protected]> |
On Sat, 8 Aug 2026 20:19:25 +0200 Miguel Ojeda <[email protected]> wrote: > On Fri, Jul 24, 2026 at 1:40 AM Gary Guo <[email protected]> wrote: >> >> Also, the proper fix would be to mark it as used in the `warn_flags` macro >> that discard the expression. >> >> if false { >> _ = $flags; >> } > > Maybe it could be nice to have a `discard!` macro later on. Looks like declare_trace! in rust/kernel/tracepoint.rs does the same thing so I think it is worth having as a standalone macro. Since it marks the expressions as used without evaluating them, how about `mark_used!`? I will send a patch once this lands.