| 1 | fn main() { |
| 2 | let cfg = match autocfg::AutoCfg::new() { |
| 3 | Ok(cfg) => cfg, |
| 4 | Err(e) => { |
| 5 | // If we couldn't detect the compiler version and features, just |
| 6 | // print a warning. This isn't a fatal error: we can still build |
| 7 | // Slab, we just can't enable cfgs automatically. |
| 8 | println!( |
| 9 | "cargo:warning=slab: failed to detect compiler features: {}" , |
| 10 | e |
| 11 | ); |
| 12 | return; |
| 13 | } |
| 14 | }; |
| 15 | // Note that this is `no_`*, not `has_*`. This allows treating as the latest |
| 16 | // stable rustc is used when the build script doesn't run. This is useful |
| 17 | // for non-cargo build systems that don't run the build script. |
| 18 | if !cfg.probe_rustc_version(1, 39) { |
| 19 | println!("cargo:rustc-cfg=slab_no_const_vec_new" ); |
| 20 | } |
| 21 | if !cfg.probe_rustc_version(1, 46) { |
| 22 | println!("cargo:rustc-cfg=slab_no_track_caller" ); |
| 23 | } |
| 24 | } |
| 25 | |