File tree Expand file tree Collapse file tree 1 file changed +4
-11
lines changed Expand file tree Collapse file tree 1 file changed +4
-11
lines changed Original file line number Diff line number Diff line change @@ -271,6 +271,9 @@ The instruction can be used like this:
271
271
``` rust,no_run
272
272
// build.rs
273
273
println!("cargo::rustc-check-cfg=cfg(foo, values(\"bar\"))");
274
+ if foo_bar_condition {
275
+ println!("cargo::rustc-cfg=foo=\"bar\"");
276
+ }
274
277
```
275
278
276
279
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
280
283
[ ` cargo::rustc-cfg ` ] [ option-cfg ] instructions as closely as possible in order to
281
284
avoid typos, missing check-cfg, stale cfgs...
282
285
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
294
287
[ conditional compilation] [ conditional-compilation-example ] example.
295
288
296
289
[ check-cfg-blog-post ] : https://blog.rust-lang.org/2024/05/06/check-cfg.html
You can’t perform that action at this time.
0 commit comments