about summary refs log tree commit diff
path: root/src/libstd/rt/util.rs
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2014-05-20 20:19:39 -0700
committerBrian Anderson <banderson@mozilla.com>2014-05-23 15:27:48 -0700
commit1240197a5b64611078b4645b81663c206217dcb6 (patch)
tree6d3ef3db662c61d58af3e4357614d28e1d4dc59a /src/libstd/rt/util.rs
parent53db981148eb359f63ecfe4cf9815b5ed0da8f3f (diff)
downloadrust-1240197a5b64611078b4645b81663c206217dcb6.tar.gz
rust-1240197a5b64611078b4645b81663c206217dcb6.zip
std: Move running_on_valgrind to rt::util. #1457
[breaking-change]
Diffstat (limited to 'src/libstd/rt/util.rs')
-rw-r--r--src/libstd/rt/util.rs14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/libstd/rt/util.rs b/src/libstd/rt/util.rs
index 1ab9ac1b11e..103fbdc0bc9 100644
--- a/src/libstd/rt/util.rs
+++ b/src/libstd/rt/util.rs
@@ -15,11 +15,11 @@ use io::IoResult;
 use io;
 use iter::Iterator;
 use libc;
+use libc::uintptr_t;
 use option::{Some, None, Option};
 use os;
 use result::Ok;
 use str::{Str, StrSlice};
-use unstable::running_on_valgrind;
 use slice::ImmutableVector;
 
 // Indicates whether we should perform expensive sanity checks, including rtassert!
@@ -162,3 +162,15 @@ memory and partly incapable of presentation to others.",
         unsafe { intrinsics::abort() }
     }
 }
+
+/// Dynamically inquire about whether we're running under V.
+/// You should usually not use this unless your test definitely
+/// can't run correctly un-altered. Valgrind is there to help
+/// you notice weirdness in normal, un-doctored code paths!
+pub fn running_on_valgrind() -> bool {
+    unsafe { rust_running_on_valgrind() != 0 }
+}
+
+extern {
+    fn rust_running_on_valgrind() -> uintptr_t;
+}