lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <CANiq72=rd+AcTSs3QNf+fju1pMg7peb0QK_B1jfVEr4E2BNrzw@mail.gmail.com>
Date: Tue, 20 Jan 2026 21:04:33 +0100
From: Miguel Ojeda <miguel.ojeda.sandonis@...il.com>
To: Christopher Erleigh <christopher.erleigh@...il.com>, Benno Lossin <lossin@...nel.org>, 
	Tamir Duberstein <tamird@...nel.org>, Trevor Gross <tmgross@...ch.edu>
Cc: rust-for-linux@...r.kernel.org, linux-kernel@...r.kernel.org, 
	ojeda@...nel.org, fujita.tomonori@...il.com, frederic@...nel.org, 
	Gary Guo <gary@...yguo.net>, Boqun Feng <boqun.feng@...il.com>, 
	Björn Roy Baron <bjorn3_gh@...tonmail.com>, 
	Andreas Hindborg <a.hindborg@...nel.org>, Alice Ryhl <aliceryhl@...gle.com>, 
	Danilo Krummrich <dakr@...nel.org>
Subject: Re: [PATCH] rust: macros: add if_cfg! macro for config-based conditionals

On Tue, Jan 20, 2026 at 5:28 PM Christopher Erleigh
<christopher.erleigh@...il.com> wrote:
>
> This macro simplifies conditional compilation patterns by providing a
> more readable syntax for selecting code based on kernel configuration
> options. It replaces verbose #[cfg(...)] and #[cfg(not(...))] blocks
> with a cleaner if_cfg!(if CONFIG_FOO { expr1 } else { expr2 }) syntax.

Regarding the feature itself, IIRC, wasn't this coming soon to the
standard library?

Cc'ing Benno who created the issue and Trevor and Tamir who were involved there.

There is a PR to stabilize the feature:

    https://github.com/rust-lang/rust/pull/149783

It would be interesting to see if we can use that one already and how
it would look like in the kernel.

Otherwise, if the feature was not ready enough by e.g. 1.85 which will
be our new minimum, then we should probably convert a patch like this
one into following the same name etc. so that eventually we can
migrate.

Well, Trevor mentioned we shouldn't half a year ago, due to syntax
change proposals, but nowadays it seems closer to stabilization?

Personally, I don't love that we need a macro for this, but if it is
going to be in the standard library and well-formatted by `rustfmt`,
then I guess it is OK...

Cheers,
Miguel

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ