Skip to content

Commit 93dc3be

Browse files
committed
docs: rust: include other expressions in conditional compilation section
Expand the conditional compilation section to explain how to support other expressions, such as testing whether `RUSTC_VERSION` is at least a given version, which requires a numerical comparison that Rust's `cfg` predicates do not support (yet?). Reviewed-by: Nicolas Schier <[email protected]> Tested-by: Alice Ryhl <[email protected]> Acked-by: Masahiro Yamada <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Miguel Ojeda <[email protected]>
1 parent aeb0e24 commit 93dc3be

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Documentation/rust/general-information.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,3 +151,11 @@ configuration:
151151
#[cfg(CONFIG_X="y")] // Enabled as a built-in (`y`)
152152
#[cfg(CONFIG_X="m")] // Enabled as a module (`m`)
153153
#[cfg(not(CONFIG_X))] // Disabled
154+
155+
For other predicates that Rust's ``cfg`` does not support, e.g. expressions with
156+
numerical comparisons, one may define a new Kconfig symbol:
157+
158+
.. code-block:: kconfig
159+
160+
config RUSTC_VERSION_MIN_107900
161+
def_bool y if RUSTC_VERSION >= 107900

0 commit comments

Comments
 (0)