1extern crate autocfg;
2
3fn main() {
4 // Normally, cargo will set `OUT_DIR` for build scripts.
5 let ac = autocfg::AutoCfg::with_dir("target").unwrap();
6
7 // since ancient times...
8 ac.emit_has_trait("std::ops::Add");
9 ac.emit_trait_cfg("std::ops::Add", "has_ops");
10
11 // trait parameters have to be provided
12 ac.emit_has_trait("std::borrow::Borrow<str>");
13 ac.emit_trait_cfg("std::borrow::Borrow<str>", "has_borrow");
14
15 // rustc 1.8.0
16 ac.emit_has_trait("std::ops::AddAssign");
17 ac.emit_trait_cfg("std::ops::AddAssign", "has_assign_ops");
18
19 // rustc 1.12.0
20 ac.emit_has_trait("std::iter::Sum");
21 ac.emit_trait_cfg("std::iter::Sum", "has_sum");
22
23 // rustc 1.28.0
24 ac.emit_has_trait("std::alloc::GlobalAlloc");
25 ac.emit_trait_cfg("std::alloc::GlobalAlloc", "has_global_alloc");
26}
27