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:
271271``` rust,no_run
272272// build.rs
273273println!("cargo::rustc-check-cfg=cfg(foo, values(\"bar\"))");
274+ if foo_bar_condition {
275+ println!("cargo::rustc-cfg=foo=\"bar\"");
276+ }
274277```
275278
276279Note 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
281284avoid 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[ option-check-cfg ] : ../../rustc/command-line-arguments.md#option-check-cfg
You can’t perform that action at this time.
0 commit comments