Skip to content

Commit 30e5f04

Browse files
committed
docs(ref): Flatten the check-cfg structure
1 parent 1bcdd13 commit 30e5f04

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

src/doc/src/reference/build-scripts.md

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,9 @@ The instruction can be used like this:
271271
```rust,no_run
272272
// build.rs
273273
println!("cargo::rustc-check-cfg=cfg(foo, values(\"bar\"))");
274+
if foo_bar_condition {
275+
println!("cargo::rustc-cfg=foo=\"bar\"");
276+
}
274277
```
275278

276279
Note that all possible cfgs should be defined, regardless of which cfgs are
@@ -280,17 +283,7 @@ It is recommended to group the `cargo::rustc-check-cfg` and
280283
[`cargo::rustc-cfg`][option-cfg] instructions as closely as possible in order to
281284
avoid typos, missing check-cfg, stale cfgs...
282285

283-
#### Example of using `cargo::rustc-check-cfg` and `cargo::rustc-cfg` together
284-
285-
```rust,no_run
286-
// build.rs
287-
println!("cargo::rustc-check-cfg=cfg(foo, values(\"bar\"))");
288-
if foo_bar_condition {
289-
println!("cargo::rustc-cfg=foo=\"bar\"");
290-
}
291-
```
292-
293-
For a more complete example see the
286+
See also the
294287
[conditional compilation][conditional-compilation-example] example.
295288

296289
[check-cfg-blog-post]: https://blog.rust-lang.org/2024/05/06/check-cfg.html

0 commit comments

Comments
 (0)