Joel Galenson | a92be9e | 2020-08-05 11:56:59 -0700 | [diff] [blame] | 1 | extern crate autocfg; |
| 2 | |
| 3 | use std::env; |
| 4 | |
| 5 | fn main() { |
| 6 | let ac = autocfg::new(); |
Haibo Huang | fa1e128 | 2020-10-29 19:19:23 -0700 | [diff] [blame] | 7 | |
| 8 | // If the "i128" feature is explicity requested, don't bother probing for it. |
| 9 | // It will still cause a build error if that was set improperly. |
| 10 | if env::var_os("CARGO_FEATURE_I128").is_some() || ac.probe_type("i128") { |
| 11 | autocfg::emit("has_i128"); |
Joel Galenson | a92be9e | 2020-08-05 11:56:59 -0700 | [diff] [blame] | 12 | } |
Haibo Huang | fa1e128 | 2020-10-29 19:19:23 -0700 | [diff] [blame] | 13 | |
Joel Galenson | a92be9e | 2020-08-05 11:56:59 -0700 | [diff] [blame] | 14 | ac.emit_expression_cfg( |
| 15 | "unsafe { 1f64.to_int_unchecked::<i32>() }", |
| 16 | "has_to_int_unchecked", |
| 17 | ); |
| 18 | |
| 19 | autocfg::rerun_path("build.rs"); |
| 20 | } |