Rename 'nightly' feature to 'unstable'.

This commit is contained in:
Chris Morgan 2015-06-10 08:59:47 +10:00
parent ecb4c45060
commit 035fb94cd2
6 changed files with 25 additions and 22 deletions

View file

@ -1,9 +1,12 @@
language: rust language: rust
rust:
- nightly
- beta
env: env:
global: global:
- secure: nR+DJRUQ9v03nNZMpMu1tGKLKBAqdQsTIAr8ffdl+DUEh3b2jvQ+vLLNFLPjsloqhoOXo7cWO7qVpiE4ZOq2lNDURQjdiZGFjh/Y5+xKy2BqFdV7qQ1JoBzsMyx28tQTYz0mtBsACiCYKKb+ddNX5hpwrsjp8cS7htZktA5kbiU= - secure: nR+DJRUQ9v03nNZMpMu1tGKLKBAqdQsTIAr8ffdl+DUEh3b2jvQ+vLLNFLPjsloqhoOXo7cWO7qVpiE4ZOq2lNDURQjdiZGFjh/Y5+xKy2BqFdV7qQ1JoBzsMyx28tQTYz0mtBsACiCYKKb+ddNX5hpwrsjp8cS7htZktA5kbiU=
script: script:
- if [[ "$(rustc --version)" =~ -(dev|nightly) ]]; then cargo test --features nightly; else ! cargo test --features nightly; fi - if [[ "$(rustc --version)" =~ -(dev|nightly) ]]; then cargo test --features unstable; else ! cargo test --features unstable; fi
- cargo test - cargo test
- cargo doc - cargo doc
after_script: after_script:

View file

@ -11,4 +11,4 @@ keywords = ["container", "data-structure", "map"]
license = "MIT/Apache-2.0" license = "MIT/Apache-2.0"
[features] [features]
nightly = [] unstable = []

View file

@ -18,7 +18,7 @@ Instructions
Cargo all the way: it is `anymap` on crates.io. Cargo all the way: it is `anymap` on crates.io.
For users of the nightly instead of the beta of rustc there are a couple of things behind the `nightly` feature like a `drain` method on the `RawAnyMap` and a more efficient hashing technique which makes lookup in the map a tad faster. For users of the nightly instead of the beta of rustc there are a couple of things behind the `unstable` feature like a `drain` method on the `RawAnyMap` and a more efficient hashing technique which makes lookup in the map a tad faster.
Author Author
------ ------

View file

@ -88,10 +88,10 @@ macro_rules! impl_clone {
} }
} }
#[cfg(feature = "nightly")] #[cfg(feature = "unstable")]
use std::raw::TraitObject; use std::raw::TraitObject;
#[cfg(not(feature = "nightly"))] #[cfg(not(feature = "unstable"))]
#[repr(C)] #[repr(C)]
#[allow(raw_pointer_derive)] #[allow(raw_pointer_derive)]
#[derive(Copy, Clone)] #[derive(Copy, Clone)]

View file

@ -1,6 +1,6 @@
//! This crate provides the `AnyMap` type, a safe and convenient store for one value of each type. //! This crate provides the `AnyMap` type, a safe and convenient store for one value of each type.
#![cfg_attr(feature = "nightly", feature(core, std_misc))] #![cfg_attr(feature = "unstable", feature(core, std_misc))]
#![cfg_attr(test, feature(test))] #![cfg_attr(test, feature(test))]
#![warn(missing_docs, unused_results)] #![warn(missing_docs, unused_results)]

View file

@ -5,31 +5,31 @@
use std::any::TypeId; use std::any::TypeId;
use std::borrow::Borrow; use std::borrow::Borrow;
use std::collections::hash_map::{self, HashMap}; use std::collections::hash_map::{self, HashMap};
#[cfg(feature = "nightly")] #[cfg(feature = "unstable")]
use std::collections::hash_state::HashState; use std::collections::hash_state::HashState;
use std::default::Default; use std::default::Default;
use std::hash::Hash; use std::hash::Hash;
#[cfg(feature = "nightly")] #[cfg(feature = "unstable")]
use std::hash::Hasher; use std::hash::Hasher;
use std::iter::IntoIterator; use std::iter::IntoIterator;
#[cfg(feature = "nightly")] #[cfg(feature = "unstable")]
use std::mem; use std::mem;
use std::ops::{Index, IndexMut}; use std::ops::{Index, IndexMut};
#[cfg(feature = "nightly")] #[cfg(feature = "unstable")]
use std::ptr; use std::ptr;
use any::{Any, UncheckedAnyExt}; use any::{Any, UncheckedAnyExt};
#[cfg(feature = "nightly")] #[cfg(feature = "unstable")]
struct TypeIdHasher { struct TypeIdHasher {
value: u64, value: u64,
} }
#[derive(Clone)] #[derive(Clone)]
#[cfg(feature = "nightly")] #[cfg(feature = "unstable")]
struct TypeIdState; struct TypeIdState;
#[cfg(feature = "nightly")] #[cfg(feature = "unstable")]
impl HashState for TypeIdState { impl HashState for TypeIdState {
type Hasher = TypeIdHasher; type Hasher = TypeIdHasher;
@ -38,7 +38,7 @@ impl HashState for TypeIdState {
} }
} }
#[cfg(feature = "nightly")] #[cfg(feature = "unstable")]
impl Hasher for TypeIdHasher { impl Hasher for TypeIdHasher {
#[inline(always)] #[inline(always)]
fn write(&mut self, bytes: &[u8]) { fn write(&mut self, bytes: &[u8]) {
@ -63,10 +63,10 @@ impl Hasher for TypeIdHasher {
/// doesnt tend to be so very useful. Still, if you need it, its here. /// doesnt tend to be so very useful. Still, if you need it, its here.
#[derive(Debug)] #[derive(Debug)]
pub struct RawMap<A: ?Sized + UncheckedAnyExt = Any> { pub struct RawMap<A: ?Sized + UncheckedAnyExt = Any> {
#[cfg(feature = "nightly")] #[cfg(feature = "unstable")]
inner: HashMap<TypeId, Box<A>, TypeIdState>, inner: HashMap<TypeId, Box<A>, TypeIdState>,
#[cfg(not(feature = "nightly"))] #[cfg(not(feature = "unstable"))]
inner: HashMap<TypeId, Box<A>>, inner: HashMap<TypeId, Box<A>>,
} }
@ -85,14 +85,14 @@ impl<A: ?Sized + UncheckedAnyExt> Default for RawMap<A> {
} }
} }
#[cfg(feature = "nightly")] #[cfg(feature = "unstable")]
impl_common_methods! { impl_common_methods! {
field: RawMap.inner; field: RawMap.inner;
new() => HashMap::with_hash_state(TypeIdState); new() => HashMap::with_hash_state(TypeIdState);
with_capacity(capacity) => HashMap::with_capacity_and_hash_state(capacity, TypeIdState); with_capacity(capacity) => HashMap::with_capacity_and_hash_state(capacity, TypeIdState);
} }
#[cfg(not(feature = "nightly"))] #[cfg(not(feature = "unstable"))]
impl_common_methods! { impl_common_methods! {
field: RawMap.inner; field: RawMap.inner;
new() => HashMap::new(); new() => HashMap::new();
@ -140,17 +140,17 @@ impl<A: ?Sized + UncheckedAnyExt> ExactSizeIterator for IntoIter<A> {
} }
/// RawMap drain iterator. /// RawMap drain iterator.
#[cfg(feature = "nightly")] #[cfg(feature = "unstable")]
pub struct Drain<'a, A: ?Sized + UncheckedAnyExt> { pub struct Drain<'a, A: ?Sized + UncheckedAnyExt> {
inner: hash_map::Drain<'a, TypeId, Box<A>>, inner: hash_map::Drain<'a, TypeId, Box<A>>,
} }
#[cfg(feature = "nightly")] #[cfg(feature = "unstable")]
impl<'a, A: ?Sized + UncheckedAnyExt> Iterator for Drain<'a, A> { impl<'a, A: ?Sized + UncheckedAnyExt> Iterator for Drain<'a, A> {
type Item = Box<A>; type Item = Box<A>;
#[inline] fn next(&mut self) -> Option<Box<A>> { self.inner.next().map(|x| x.1) } #[inline] fn next(&mut self) -> Option<Box<A>> { self.inner.next().map(|x| x.1) }
#[inline] fn size_hint(&self) -> (usize, Option<usize>) { self.inner.size_hint() } #[inline] fn size_hint(&self) -> (usize, Option<usize>) { self.inner.size_hint() }
} }
#[cfg(feature = "nightly")] #[cfg(feature = "unstable")]
impl<'a, A: ?Sized + UncheckedAnyExt> ExactSizeIterator for Drain<'a, A> { impl<'a, A: ?Sized + UncheckedAnyExt> ExactSizeIterator for Drain<'a, A> {
#[inline] fn len(&self) -> usize { self.inner.len() } #[inline] fn len(&self) -> usize { self.inner.len() }
} }
@ -182,7 +182,7 @@ impl<A: ?Sized + UncheckedAnyExt> RawMap<A> {
/// ///
/// Keeps the allocated memory for reuse. /// Keeps the allocated memory for reuse.
#[inline] #[inline]
#[cfg(feature = "nightly")] #[cfg(feature = "unstable")]
pub fn drain(&mut self) -> Drain<A> { pub fn drain(&mut self) -> Drain<A> {
Drain { Drain {
inner: self.inner.drain(), inner: self.inner.drain(),