File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,33 @@ use std::env;
22use std:: process:: Command ;
33use std:: str;
44
5+ // List of cfgs this build script is allowed to set. The list is needed to support check-cfg, as we
6+ // need to know all the possible cfgs that this script will set. If you need to set another cfg
7+ // make sure to add it to this list as well.
8+ const ALLOWED_CFGS : & [ & str ] = & [
9+ "freebsd10" ,
10+ "freebsd11" ,
11+ "freebsd12" ,
12+ "freebsd13" ,
13+ "freebsd14" ,
14+ "libc_align" ,
15+ "libc_cfg_target_vendor" ,
16+ "libc_const_extern_fn" ,
17+ "libc_const_extern_fn_unstable" ,
18+ "libc_const_size_of" ,
19+ "libc_core_cvoid" ,
20+ "libc_deny_warnings" ,
21+ "libc_int128" ,
22+ "libc_long_array" ,
23+ "libc_non_exhaustive" ,
24+ "libc_packedN" ,
25+ "libc_priv_mod_use" ,
26+ "libc_ptr_addr_of" ,
27+ "libc_thread_local" ,
28+ "libc_underscore_const_names" ,
29+ "libc_union" ,
30+ ] ;
31+
532fn main ( ) {
633 // Avoid unnecessary re-building.
734 println ! ( "cargo:rerun-if-changed=build.rs" ) ;
@@ -181,5 +208,8 @@ fn which_freebsd() -> Option<i32> {
181208}
182209
183210fn set_cfg ( cfg : & str ) {
211+ if !ALLOWED_CFGS . contains ( & cfg) {
212+ panic ! ( "trying to set cfg {}, but it is not in ALLOWED_CFGS" , cfg) ;
213+ }
184214 println ! ( "cargo:rustc-cfg={}" , cfg) ;
185215}
You can’t perform that action at this time.
0 commit comments