From e6c090de882c06cac01cf32d3aa359c608044ea7 Mon Sep 17 00:00:00 2001 From: bluss Date: Fri, 24 Mar 2017 18:50:57 +0100 Subject: [PATCH 1/2] New minimum Rust version --- .travis.yml | 2 +- README.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index bf91f07..ea15bb1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,7 @@ language: rust sudo: false matrix: include: - - rust: 1.2.0 + - rust: 1.12.0 - rust: stable env: - FEATURES="use_generic_array" diff --git a/README.rst b/README.rst index 187410a..98ef582 100644 --- a/README.rst +++ b/README.rst @@ -2,7 +2,7 @@ arrayvec ======== -A vector with fixed capacity. Requires Rust 1.2+. +A vector with fixed capacity. Requires Rust 1.12.0 or later. Please read the `API documentation here`__ From f65ea92da49f7b8cda6ce5df6f7ec85d484046eb Mon Sep 17 00:00:00 2001 From: bluss Date: Fri, 24 Mar 2017 18:52:05 +0100 Subject: [PATCH 2/2] Remove the optional generic-array feature - It can be added back later if needed - A public dependency implies version coupling, and we can't afford to have it for a niche use case. --- .travis.yml | 3 +-- Cargo.toml | 5 ----- src/array.rs | 18 ------------------ src/lib.rs | 8 -------- tests/generic_array.rs | 23 ----------------------- 5 files changed, 1 insertion(+), 56 deletions(-) delete mode 100644 tests/generic_array.rs diff --git a/.travis.yml b/.travis.yml index ea15bb1..dded38b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,6 @@ matrix: - rust: 1.12.0 - rust: stable env: - - FEATURES="use_generic_array" - NODEFAULT=1 - rust: beta - rust: nightly @@ -16,7 +15,7 @@ matrix: - NODROP_FEATURES='use_needs_drop' - rust: nightly env: - - FEATURES='use_union use_generic_array' + - FEATURES='use_union' - NODROP_FEATURES='use_union' branches: only: diff --git a/Cargo.toml b/Cargo.toml index 09f421c..edbcff7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,12 +19,7 @@ version = "0.1.8" path = "nodrop" default-features = false -[dependencies.generic-array] -version = "0.5.1" -optional = true - [features] default = ["std"] std = ["odds/std", "nodrop/std"] use_union = ["nodrop/use_union"] -use_generic_array = ["generic-array"] diff --git a/src/array.rs b/src/array.rs index afd869f..d21a241 100644 --- a/src/array.rs +++ b/src/array.rs @@ -32,24 +32,6 @@ pub trait ArrayExt : Array { impl ArrayExt for A where A: Array { } -#[cfg(feature = "use_generic_array")] -unsafe impl Array for ::generic_array::GenericArray - where U: ::generic_array::ArrayLength -{ - type Item = T; - type Index = usize; - fn as_ptr(&self) -> *const Self::Item { - (**self).as_ptr() - } - fn as_mut_ptr(&mut self) -> *mut Self::Item { - (**self).as_mut_ptr() - } - fn capacity() -> usize { - U::to_usize() - } - -} - impl Index for u8 { #[inline(always)] fn to_usize(self) -> usize { self as usize } diff --git a/src/lib.rs b/src/lib.rs index 38cfa7b..1bbf379 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -14,19 +14,11 @@ //! - Use the unstable feature untagged unions for the internal implementation, //! which has reduced space overhead //! -//! - `use_generic_array` -//! - Optional -//! - Requires Rust stable channel -//! - Depend on generic-array and allow using it just like a fixed -//! size array for ArrayVec storage. #![doc(html_root_url="https://docs.rs/arrayvec/0.3/")] #![cfg_attr(not(feature="std"), no_std)] extern crate odds; extern crate nodrop; -#[cfg(feature = "use_generic_array")] -extern crate generic_array; - #[cfg(not(feature="std"))] extern crate core as std; diff --git a/tests/generic_array.rs b/tests/generic_array.rs deleted file mode 100644 index 3857f1e..0000000 --- a/tests/generic_array.rs +++ /dev/null @@ -1,23 +0,0 @@ -#![cfg(feature = "use_generic_array")] - -extern crate arrayvec; -#[macro_use] -extern crate generic_array; - -use arrayvec::ArrayVec; - -use generic_array::GenericArray; - -use generic_array::typenum::U41; - -#[test] -fn test_simple() { - let mut vec: ArrayVec> = ArrayVec::new(); - - assert_eq!(vec.len(), 0); - assert_eq!(vec.capacity(), 41); - vec.extend(0..20); - assert_eq!(vec.len(), 20); - assert_eq!(&vec[..5], &[0, 1, 2, 3, 4]); -} -