Skip to content

Commit f7705a0

Browse files
committed
Move example to an example block
1 parent 9c3f477 commit f7705a0

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

src/conditional-compilation.md

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -420,18 +420,19 @@ r[cfg.cfg_attr.behavior]
420420
When the configuration predicate is true, `cfg_attr` expands out to the attributes listed after the predicate.
421421

422422
r[cfg.cfg_attr.attribute-list]
423-
Zero, one, or more attributes may be listed. Multiple attributes will each be expanded into separate attributes. For example:
423+
Zero, one, or more attributes may be listed. Multiple attributes will each be expanded into separate attributes.
424424

425-
<!-- ignore: fake attributes -->
426-
```rust,ignore
427-
#[cfg_attr(feature = "magic", sparkles, crackles)]
428-
fn bewitched() {}
429-
430-
// When the `magic` feature flag is enabled, the above will expand to:
431-
#[sparkles]
432-
#[crackles]
433-
fn bewitched() {}
434-
```
425+
> [!EXAMPLE]
426+
> <!-- ignore: fake attributes -->
427+
> ```rust,ignore
428+
> #[cfg_attr(feature = "magic", sparkles, crackles)]
429+
> fn bewitched() {}
430+
>
431+
> // When the `magic` feature flag is enabled, the above will expand to:
432+
> #[sparkles]
433+
> #[crackles]
434+
> fn bewitched() {}
435+
> ```
435436
436437
> [!NOTE]
437438
> The `cfg_attr` can expand to another `cfg_attr`. For example, `#[cfg_attr(target_os = "linux", cfg_attr(feature = "multithreaded", some_other_attribute))]` is valid. This example would be equivalent to `#[cfg_attr(all(target_os = "linux", feature ="multithreaded"), some_other_attribute)]`.

0 commit comments

Comments
 (0)