summaryrefslogtreecommitdiffstats
path: root/vendor/autocfg/examples/paths.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
commit698f8c2f01ea549d77d7dc3338a12e04c11057b9 (patch)
tree173a775858bd501c378080a10dca74132f05bc50 /vendor/autocfg/examples/paths.rs
parentInitial commit. (diff)
downloadrustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.tar.xz
rustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.zip
Adding upstream version 1.64.0+dfsg1.upstream/1.64.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/autocfg/examples/paths.rs')
-rw-r--r--vendor/autocfg/examples/paths.rs22
1 files changed, 22 insertions, 0 deletions
diff --git a/vendor/autocfg/examples/paths.rs b/vendor/autocfg/examples/paths.rs
new file mode 100644
index 000000000..b7a6ca7a2
--- /dev/null
+++ b/vendor/autocfg/examples/paths.rs
@@ -0,0 +1,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");
+}