The `cfg` directives returned by the build script via the `cargo:rustc-cfg=foo` convention are not passed to `rustdoc` when invoking `cargo doc`. `rustdoc` seems to accept them just fine i.e. invoking it manually with `--cfg foo` produces the expected results.