From bbbb571fee01532f63b105150654db8db0b01bf7 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Mon, 9 Feb 2015 16:33:19 -0800 Subject: rustc: Fix a number of stability lint holes There are a number of holes that the stability lint did not previously cover, including: * Types * Bounds on type parameters on functions and impls * Where clauses * Imports * Patterns (structs and enums) These holes have all been fixed by overriding the `visit_path` function on the AST visitor instead of a few specialized cases. This change also necessitated a few stability changes: * The `collections::fmt` module is now stable (it was already supposed to be). * The `thread_local::imp::Key` type is now stable (it was already supposed to be). * The `std::rt::{begin_unwind, begin_unwind_fmt}` functions are now stable. These are required via the `panic!` macro. * The `std::old_io::stdio::{println, println_args}` functions are now stable. These are required by the `print!` and `println!` macros. * The `ops::{FnOnce, FnMut, Fn}` traits are now `#[stable]`. This is required to make bounds with these traits stable. Note that manual implementations of these traits are still gated by default, this stability only allows bounds such as `F: FnOnce()`. Additionally, the compiler now has special logic to ignore its own generated `__test` module for the `--test` harness in terms of stability. Closes #8962 Closes #16360 Closes #20327 [breaking-change] --- src/libstd/sync/mpsc/select.rs | 6 +++--- src/libstd/sync/mpsc/shared.rs | 12 ++++++------ src/libstd/sync/mpsc/stream.rs | 8 ++++---- src/libstd/sync/once.rs | 8 ++++---- 4 files changed, 17 insertions(+), 17 deletions(-) (limited to 'src/libstd/sync') diff --git a/src/libstd/sync/mpsc/select.rs b/src/libstd/sync/mpsc/select.rs index 85c7572404b..babae93b2d4 100644 --- a/src/libstd/sync/mpsc/select.rs +++ b/src/libstd/sync/mpsc/select.rs @@ -61,7 +61,7 @@ use core::cell::Cell; use core::marker; use core::mem; use core::ptr; -use core::uint; +use core::usize; use sync::mpsc::{Receiver, RecvError}; use sync::mpsc::blocking::{self, SignalToken}; @@ -228,7 +228,7 @@ impl Select { // A rewrite should focus on avoiding a yield loop, and for now this // implementation is tying us over to a more efficient "don't // iterate over everything every time" implementation. - let mut ready_id = uint::MAX; + let mut ready_id = usize::MAX; for handle in self.iter() { if (*handle).packet.abort_selection() { ready_id = (*handle).id; @@ -236,7 +236,7 @@ impl Select { } // We must have found a ready receiver - assert!(ready_id != uint::MAX); + assert!(ready_id != usize::MAX); return ready_id; } } diff --git a/src/libstd/sync/mpsc/shared.rs b/src/libstd/sync/mpsc/shared.rs index c97af4c6bca..6c31fb92591 100644 --- a/src/libstd/sync/mpsc/shared.rs +++ b/src/libstd/sync/mpsc/shared.rs @@ -23,7 +23,7 @@ pub use self::Failure::*; use core::prelude::*; use core::cmp; -use core::int; +use core::isize; use sync::atomic::{AtomicUsize, AtomicIsize, AtomicBool, Ordering}; use sync::mpsc::blocking::{self, SignalToken}; @@ -33,17 +33,17 @@ use sync::mpsc::select::StartResult; use sync::{Mutex, MutexGuard}; use thread::Thread; -const DISCONNECTED: int = int::MIN; -const FUDGE: int = 1024; +const DISCONNECTED: isize = isize::MIN; +const FUDGE: isize = 1024; #[cfg(test)] -const MAX_STEALS: int = 5; +const MAX_STEALS: isize = 5; #[cfg(not(test))] -const MAX_STEALS: int = 1 << 20; +const MAX_STEALS: isize = 1 << 20; pub struct Packet { queue: mpsc::Queue, cnt: AtomicIsize, // How many items are on this channel - steals: int, // How many times has a port received without blocking? + steals: isize, // How many times has a port received without blocking? to_wake: AtomicUsize, // SignalToken for wake up // The number of channels which are currently using this packet. diff --git a/src/libstd/sync/mpsc/stream.rs b/src/libstd/sync/mpsc/stream.rs index a03add8c532..ab9bd6b2ed7 100644 --- a/src/libstd/sync/mpsc/stream.rs +++ b/src/libstd/sync/mpsc/stream.rs @@ -25,7 +25,7 @@ use self::Message::*; use core::prelude::*; use core::cmp; -use core::int; +use core::isize; use thread::Thread; use sync::atomic::{AtomicIsize, AtomicUsize, Ordering, AtomicBool}; @@ -33,11 +33,11 @@ use sync::mpsc::Receiver; use sync::mpsc::blocking::{self, SignalToken}; use sync::mpsc::spsc_queue as spsc; -const DISCONNECTED: int = int::MIN; +const DISCONNECTED: isize = isize::MIN; #[cfg(test)] -const MAX_STEALS: int = 5; +const MAX_STEALS: isize = 5; #[cfg(not(test))] -const MAX_STEALS: int = 1 << 20; +const MAX_STEALS: isize = 1 << 20; pub struct Packet { queue: spsc::Queue>, // internal queue for all message diff --git a/src/libstd/sync/once.rs b/src/libstd/sync/once.rs index 2df211f3768..29c2051e5ad 100644 --- a/src/libstd/sync/once.rs +++ b/src/libstd/sync/once.rs @@ -13,7 +13,7 @@ //! This primitive is meant to be used to run one-time initialization. An //! example use case would be for initializing an FFI library. -use int; +use isize; use marker::Sync; use mem::drop; use ops::FnOnce; @@ -99,9 +99,9 @@ impl Once { let prev = self.cnt.fetch_add(1, Ordering::SeqCst); if prev < 0 { - // Make sure we never overflow, we'll never have int::MIN + // Make sure we never overflow, we'll never have isize::MIN // simultaneous calls to `call_once` to make this value go back to 0 - self.cnt.store(int::MIN, Ordering::SeqCst); + self.cnt.store(isize::MIN, Ordering::SeqCst); return } @@ -111,7 +111,7 @@ impl Once { let guard = self.mutex.lock(); if self.cnt.load(Ordering::SeqCst) > 0 { f(); - let prev = self.cnt.swap(int::MIN, Ordering::SeqCst); + let prev = self.cnt.swap(isize::MIN, Ordering::SeqCst); self.lock_cnt.store(prev, Ordering::SeqCst); } drop(guard); -- cgit 1.4.1-3-g733a5