From 8371f595176e0522d920d01ef9d47f5dcbc80f56 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Thu, 26 Dec 2024 12:49:37 -0800 Subject: [PATCH] Document rustversion::cfg --- README.md | 5 +++++ src/lib.rs | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/README.md b/README.md index 2c4be07..a77ad61 100644 --- a/README.md +++ b/README.md @@ -73,6 +73,11 @@ rustversion = "1.0" —
For conditional inclusion of attributes; analogous to `cfg_attr`. +- `rustversion::cfg!(`selector`)` + —
+ An expression form of any of the above attributes; for example + *if rustversion::cfg!(any(stable, beta)) { ... }*. +
## Use cases diff --git a/src/lib.rs b/src/lib.rs index 977fa89..7da533a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -93,6 +93,13 @@ //! cfg_attr. //!

//! +//! -

+//! rustversion::cfg!(selector) +//! —
+//! An expression form of any of the above attributes; for example +//! if rustversion::cfg!(any(stable, beta)) { ... }. +//!

+//! //!
//! //! # Use cases