Skip to content

Commit

Permalink
Allow some unused unsafes until the next snapshot
Browse files Browse the repository at this point in the history
  • Loading branch information
flaper87 committed Apr 11, 2014
1 parent 9ff0811 commit 2b98349
Show file tree
Hide file tree
Showing 12 changed files with 22 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/libgreen/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,7 @@ impl SchedPool {
///
/// This will configure the pool according to the `config` parameter, and
/// initially run `main` inside the pool of schedulers.
#[allow(unused_unsafe)] // NOTE: Remove after next snapshot (and the unsafe block)
pub fn new(config: PoolConfig) -> SchedPool {
static mut POOL_ID: AtomicUint = INIT_ATOMIC_UINT;

Expand Down
2 changes: 2 additions & 0 deletions src/liblog/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ pub fn log(level: u32, args: &fmt::Arguments) {
/// safely
#[doc(hidden)]
#[inline(always)]
#[allow(unused_unsafe)] // NOTE: Remove after next snapshot (and the unsafe block)
pub fn log_level() -> u32 { unsafe { LOG_LEVEL } }

/// Replaces the task-local logger with the specified logger, returning the old
Expand All @@ -227,6 +228,7 @@ pub fn set_logger(logger: ~Logger:Send) -> Option<~Logger:Send> {
/// logging. This is the second layer of defense about determining whether a
/// module's log statement should be emitted or not.
#[doc(hidden)]
#[allow(unused_unsafe)] // NOTE: Remove after next snapshot (and the unsafe block)
pub fn mod_enabled(level: u32, module: &str) -> bool {
static mut INIT: Once = ONCE_INIT;
unsafe { INIT.doit(init); }
Expand Down
1 change: 1 addition & 0 deletions src/librustc/middle/trans/debuginfo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2307,6 +2307,7 @@ fn cache_id_for_type(t: ty::t) -> uint {

// Used to avoid LLVM metadata uniquing problems. See `create_struct_stub()` and
// `prepare_enum_metadata()`.
#[allow(unused_unsafe)] // NOTE: Remove after next snapshot (and the unsafe block)
fn generate_unique_type_id(prefix: &'static str) -> ~str {
unsafe {
static mut unique_id_counter: atomics::AtomicUint = atomics::INIT_ATOMIC_UINT;
Expand Down
4 changes: 4 additions & 0 deletions src/librustc/middle/ty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1989,6 +1989,10 @@ pub fn type_is_sendable(cx: &ctxt, t: ty::t) -> bool {
type_contents(cx, t).is_sendable(cx)
}

pub fn type_is_sharable(cx: &ctxt, t: ty::t) -> bool {
type_contents(cx, t).is_sharable(cx)
}

pub fn type_interior_is_unsafe(cx: &ctxt, t: ty::t) -> bool {
type_contents(cx, t).interior_unsafe()
}
Expand Down
1 change: 1 addition & 0 deletions src/libstd/io/tempfile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ impl TempDir {
/// deleted once the returned wrapper is destroyed.
///
/// If no directory can be created, None is returned.
#[allow(unused_unsafe)] // NOTE: Remove after next snapshot (and the unsafe block)
pub fn new_in(tmpdir: &Path, suffix: &str) -> Option<TempDir> {
if !tmpdir.is_absolute() {
return TempDir::new_in(&os::make_absolute(tmpdir), suffix);
Expand Down
2 changes: 2 additions & 0 deletions src/libstd/io/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ macro_rules! iotest (
)

/// Get a port number, starting at 9600, for use in tests
#[allow(unused_unsafe)] // NOTE: Remove after next snapshot (and the unsafe block)
pub fn next_test_port() -> u16 {
static mut next_offset: AtomicUint = INIT_ATOMIC_UINT;
unsafe {
Expand All @@ -62,6 +63,7 @@ pub fn next_test_port() -> u16 {
}

/// Get a temporary path which could be the location of a unix socket
#[allow(unused_unsafe)] // NOTE: Remove after next snapshot (and the unsafe block)
pub fn next_test_unix() -> Path {
static mut COUNT: AtomicUint = INIT_ATOMIC_UINT;
// base port and pid are an attempt to be unique between multiple
Expand Down
2 changes: 2 additions & 0 deletions src/libstd/os.rs
Original file line number Diff line number Diff line change
Expand Up @@ -781,12 +781,14 @@ static mut EXIT_STATUS: AtomicInt = INIT_ATOMIC_INT;
*
* Note that this is not synchronized against modifications of other threads.
*/
#[allow(unused_unsafe)] // NOTE: Remove after next snapshot (and the unsafe block)
pub fn set_exit_status(code: int) {
unsafe { EXIT_STATUS.store(code, SeqCst) }
}

/// Fetches the process's current exit code. This defaults to 0 and can change
/// by calling `set_exit_status`.
#[allow(unused_unsafe)] // NOTE: Remove after next snapshot (and the unsafe block)
pub fn get_exit_status() -> int {
unsafe { EXIT_STATUS.load(SeqCst) }
}
Expand Down
1 change: 1 addition & 0 deletions src/libstd/rt/backtrace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ pub use self::imp::write;

// For now logging is turned off by default, and this function checks to see
// whether the magical environment variable is present to see if it's turned on.
#[allow(unused_unsafe)] // NOTE: Remove after next snapshot (and the unsafe block)
pub fn log_enabled() -> bool {
static mut ENABLED: atomics::AtomicInt = atomics::INIT_ATOMIC_INT;
unsafe {
Expand Down
1 change: 1 addition & 0 deletions src/libstd/rt/bookkeeping.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ use unstable::mutex::{StaticNativeMutex, NATIVE_MUTEX_INIT};
static mut TASK_COUNT: atomics::AtomicUint = atomics::INIT_ATOMIC_UINT;
static mut TASK_LOCK: StaticNativeMutex = NATIVE_MUTEX_INIT;

#[allow(unused_unsafe)] // NOTE: Remove after next snapshot (and the unsafe block)
pub fn increment() {
let _ = unsafe { TASK_COUNT.fetch_add(1, atomics::SeqCst) };
}
Expand Down
4 changes: 4 additions & 0 deletions src/libstd/rt/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ static mut MIN_STACK: uint = 2 * 1024 * 1024;
static mut MAX_CACHED_STACKS: uint = 10;
static mut DEBUG_BORROW: bool = false;

#[allow(unused_unsafe)] // NOTE: Remove after next snapshot (and the unsafe block)
pub fn init() {
unsafe {
match os::getenv("RUST_MIN_STACK") {
Expand All @@ -43,14 +44,17 @@ pub fn init() {
}
}

#[allow(unused_unsafe)] // NOTE: Remove after next snapshot (and the unsafe block)
pub fn min_stack() -> uint {
unsafe { MIN_STACK }
}

#[allow(unused_unsafe)] // NOTE: Remove after next snapshot (and the unsafe block)
pub fn max_cached_stacks() -> uint {
unsafe { MAX_CACHED_STACKS }
}

#[allow(unused_unsafe)] // NOTE: Remove after next snapshot (and the unsafe block)
pub fn debug_borrow() -> bool {
unsafe { DEBUG_BORROW }
}
2 changes: 2 additions & 0 deletions src/libstd/rt/local_ptr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ pub mod compiled {

/// Check whether there is a thread-local pointer installed.
#[inline(never)] // see comments above
#[allow(unused_unsafe)] // NOTE: Remove after next snapshot (and the unsafe block)
pub fn exists() -> bool {
unsafe {
RT_TLS_PTR.is_not_null()
Expand Down Expand Up @@ -367,6 +368,7 @@ pub mod native {
#[inline]
#[cfg(not(test))]
#[allow(visible_private_types)]
#[allow(unused_unsafe)] // NOTE: Remove after next snapshot (and the unsafe block)
pub fn maybe_tls_key() -> Option<tls::Key> {
unsafe {
// NB: This is a little racy because, while the key is
Expand Down
1 change: 1 addition & 0 deletions src/test/run-pass/ifmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ fn test_format_args() {
t!(s, "hello world");
}

#[allow(unused_unsafe)] // NOTE: Remove after next snapshot (and the unsafe block)
fn test_order() {
// Make sure format!() arguments are always evaluated in a left-to-right
// ordering
Expand Down

0 comments on commit 2b98349

Please sign in to comment.