File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -38,6 +38,10 @@ fn main() {
38
38
let align_cargo_feature = env:: var ( "CARGO_FEATURE_ALIGN" ) . is_ok ( ) ;
39
39
let const_extern_fn_cargo_feature = env:: var ( "CARGO_FEATURE_CONST_EXTERN_FN" ) . is_ok ( ) ;
40
40
let libc_ci = env:: var ( "LIBC_CI" ) . is_ok ( ) ;
41
+ let libc_check_cfg = env:: var ( "LIBC_CHECK_CFG" ) . is_ok ( ) ;
42
+
43
+ println ! ( "cargo:rerun-if-env-changed=LIBC_CI" ) ;
44
+ println ! ( "cargo:rerun-if-env-changed=LIBC_CHECK_CFG" ) ;
41
45
42
46
if env:: var ( "CARGO_FEATURE_USE_STD" ) . is_ok ( ) {
43
47
println ! (
@@ -140,6 +144,17 @@ fn main() {
140
144
set_cfg ( "libc_const_extern_fn" ) ;
141
145
}
142
146
}
147
+
148
+ // check-cfg is a nightly cargo/rustc feature to warn when unknown cfgs are used across the
149
+ // codebase. libc can configure it if the appropriate environment variable is passed. Since
150
+ // rust-lang/rust enforces it, this is useful when using a custom libc fork there.
151
+ //
152
+ // https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#check-cfg
153
+ if libc_check_cfg {
154
+ for cfg in ALLOWED_CFGS {
155
+ println ! ( "cargo:rustc-check-cfg=values({})" , cfg) ;
156
+ }
157
+ }
143
158
}
144
159
145
160
fn rustc_minor_nightly ( ) -> ( u32 , bool ) {
You can’t perform that action at this time.
0 commit comments