From a43acf11cafc0951c577783db7081eaffc5eeb5e Mon Sep 17 00:00:00 2001 From: Maxwell Borden <maxwellborden@gmail.com> Date: Wed, 13 May 2020 22:35:46 -0700 Subject: [PATCH] cfg_attr needs a valid predicate --- src/conditional-compilation.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/conditional-compilation.md b/src/conditional-compilation.md index 95285e3af..1a6b47d98 100644 --- a/src/conditional-compilation.md +++ b/src/conditional-compilation.md @@ -266,7 +266,7 @@ either be found at `linux.rs` or `windows.rs` based on the target. <!-- ignore: `mod` needs multiple files --> ```rust,ignore -#[cfg_attr(linux, path = "linux.rs")] +#[cfg_attr(target_os = "linux", path = "linux.rs")] #[cfg_attr(windows, path = "windows.rs")] mod os; ``` @@ -286,9 +286,9 @@ fn bewitched() {} ``` > **Note**: The `cfg_attr` can expand to another `cfg_attr`. For example, -> `#[cfg_attr(linux, cfg_attr(feature = "multithreaded", some_other_attribute))]` +> `#[cfg_attr(target_os = "linux", cfg_attr(feature = "multithreaded", some_other_attribute))]` > is valid. This example would be equivalent to -> `#[cfg_attr(all(linux, feature ="multithreaded"), some_other_attribute)]`. +> `#[cfg_attr(all(target_os = "linux", feature ="multithreaded"), some_other_attribute)]`. The `cfg_attr` attribute is allowed anywhere attributes are allowed.