Skip to content

Commit ef1ec45

Browse files
authored
Merge pull request #812 from Tacklebox/master
cfg_attr needs a valid predicate
2 parents c0560d7 + a43acf1 commit ef1ec45

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/conditional-compilation.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ either be found at `linux.rs` or `windows.rs` based on the target.
266266

267267
<!-- ignore: `mod` needs multiple files -->
268268
```rust,ignore
269-
#[cfg_attr(linux, path = "linux.rs")]
269+
#[cfg_attr(target_os = "linux", path = "linux.rs")]
270270
#[cfg_attr(windows, path = "windows.rs")]
271271
mod os;
272272
```
@@ -286,9 +286,9 @@ fn bewitched() {}
286286
```
287287

288288
> **Note**: The `cfg_attr` can expand to another `cfg_attr`. For example,
289-
> `#[cfg_attr(linux, cfg_attr(feature = "multithreaded", some_other_attribute))]`
289+
> `#[cfg_attr(target_os = "linux", cfg_attr(feature = "multithreaded", some_other_attribute))]`
290290
> is valid. This example would be equivalent to
291-
> `#[cfg_attr(all(linux, feature ="multithreaded"), some_other_attribute)]`.
291+
> `#[cfg_attr(all(target_os = "linux", feature ="multithreaded"), some_other_attribute)]`.
292292
293293
The `cfg_attr` attribute is allowed anywhere attributes are allowed.
294294

0 commit comments

Comments
 (0)