From 1240197a5b64611078b4645b81663c206217dcb6 Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Tue, 20 May 2014 20:19:39 -0700 Subject: [PATCH] std: Move running_on_valgrind to rt::util. #1457 [breaking-change] --- src/libstd/io/test.rs | 2 +- src/libstd/rt/mod.rs | 4 ++++ src/libstd/rt/util.rs | 14 +++++++++++++- src/libstd/unstable/mod.rs | 13 ------------- 4 files changed, 18 insertions(+), 15 deletions(-) diff --git a/src/libstd/io/test.rs b/src/libstd/io/test.rs index de8a6f4beb5e..bc52bc9946c0 100644 --- a/src/libstd/io/test.rs +++ b/src/libstd/io/test.rs @@ -37,7 +37,7 @@ mod $name { use io::net::unix::*; use io::timer::*; use io::process::*; - use unstable::running_on_valgrind; + use rt::running_on_valgrind; use str; fn f() $b diff --git a/src/libstd/rt/mod.rs b/src/libstd/rt/mod.rs index daf18346fee2..d2131ad44fb3 100644 --- a/src/libstd/rt/mod.rs +++ b/src/libstd/rt/mod.rs @@ -76,6 +76,10 @@ pub use alloc::{heap, libc_heap}; +// Used by I/O tests +#[experimental] +pub use self::util::running_on_valgrind; + // FIXME: these probably shouldn't be public... #[doc(hidden)] pub mod shouldnt_be_public { diff --git a/src/libstd/rt/util.rs b/src/libstd/rt/util.rs index 1ab9ac1b11ed..103fbdc0bc93 100644 --- a/src/libstd/rt/util.rs +++ b/src/libstd/rt/util.rs @@ -15,11 +15,11 @@ 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 @@ fn abort() -> ! { 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; +} diff --git a/src/libstd/unstable/mod.rs b/src/libstd/unstable/mod.rs index f464f70772d9..b235ec4d8c8e 100644 --- a/src/libstd/unstable/mod.rs +++ b/src/libstd/unstable/mod.rs @@ -10,8 +10,6 @@ #![doc(hidden)] -use libc::uintptr_t; - pub use core::finally; pub mod dynamic_lib; @@ -20,14 +18,3 @@ pub mod sync; pub mod mutex; -/// 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; -}