about summary refs log tree commit diff
path: root/library/stdarch/crates/std_detect/src/detect/mod.rs
diff options
context:
space:
mode:
authorLuca Barbato <lu_zero@gentoo.org>2019-09-09 11:45:41 +0200
committergnzlbg <gnzlbg@users.noreply.github.com>2019-09-09 22:20:10 +0200
commitf3140f4b25860a1aa6257c6afc064efe177b0b67 (patch)
tree8f3203c395f3fe7b4aff87449d04606e958cfa7b /library/stdarch/crates/std_detect/src/detect/mod.rs
parent5b11935d4331f9a908f00359cc3e96e99e055be1 (diff)
downloadrust-f3140f4b25860a1aa6257c6afc064efe177b0b67.tar.gz
rust-f3140f4b25860a1aa6257c6afc064efe177b0b67.zip
Factor out check_for
All the os-specific code implements a `check_for` and a `detect_features`.

Move the always identical check_for in the mod.rs and use
`os::detect_features` there.
Diffstat (limited to 'library/stdarch/crates/std_detect/src/detect/mod.rs')
-rw-r--r--library/stdarch/crates/std_detect/src/detect/mod.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/library/stdarch/crates/std_detect/src/detect/mod.rs b/library/stdarch/crates/std_detect/src/detect/mod.rs
index 80207daad8f..3e00c205547 100644
--- a/library/stdarch/crates/std_detect/src/detect/mod.rs
+++ b/library/stdarch/crates/std_detect/src/detect/mod.rs
@@ -90,4 +90,9 @@ cfg_if! {
         mod os;
     }
 }
-pub use self::os::check_for;
+
+/// Performs run-time feature detection.
+#[inline]
+pub fn check_for(x: Feature) -> bool {
+    cache::test(x as u32, self::os::detect_features)
+}