summaryrefslogtreecommitdiffstats
path: root/third_party/rust/autocfg/examples/paths.rs
blob: b7a6ca7a25f7b35ae2e535ccc16cc1a53339f90f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
extern crate autocfg;

fn main() {
    // Normally, cargo will set `OUT_DIR` for build scripts.
    let ac = autocfg::AutoCfg::with_dir("target").unwrap();

    // since ancient times...
    ac.emit_has_path("std::vec::Vec");
    ac.emit_path_cfg("std::vec::Vec", "has_vec");

    // rustc 1.10.0
    ac.emit_has_path("std::panic::PanicInfo");
    ac.emit_path_cfg("std::panic::PanicInfo", "has_panic_info");

    // rustc 1.20.0
    ac.emit_has_path("std::mem::ManuallyDrop");
    ac.emit_path_cfg("std::mem::ManuallyDrop", "has_manually_drop");

    // rustc 1.25.0
    ac.emit_has_path("std::ptr::NonNull");
    ac.emit_path_cfg("std::ptr::NonNull", "has_non_null");
}