Skip to content

Commit 5e28ab4

Browse files
committed
Remove nightly feature
1 parent 4a45eb5 commit 5e28ab4

File tree

1 file changed

+0
-91
lines changed

1 file changed

+0
-91
lines changed

src/lib.rs

-91
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
//! [`Arbitrary`](./trait.Arbitrary.html) trait's documentation for details on
1515
//! automatically deriving, implementing, and/or using the trait.
1616
17-
#![cfg_attr(feature = "const-generics", feature(min_const_generics))]
1817
#![deny(bad_style)]
1918
#![deny(missing_docs)]
2019
#![deny(future_incompatible)]
@@ -714,13 +713,11 @@ macro_rules! arbitrary_tuple {
714713
}
715714
arbitrary_tuple!(A B C D E F G H I J K L M N O P Q R S T U V W X Y Z);
716715

717-
#[cfg(feature = "const-generics")]
718716
struct ArrayGuard<T, const N: usize> {
719717
dst: *mut T,
720718
initialized: usize,
721719
}
722720

723-
#[cfg(feature = "const-generics")]
724721
impl<T, const N: usize> Drop for ArrayGuard<T, N> {
725722
fn drop(&mut self) {
726723
debug_assert!(self.initialized <= N);
@@ -731,7 +728,6 @@ impl<T, const N: usize> Drop for ArrayGuard<T, N> {
731728
}
732729
}
733730

734-
#[cfg(feature = "const-generics")]
735731
fn create_array<F, T, const N: usize>(mut cb: F) -> [T; N]
736732
where
737733
F: FnMut(usize) -> T,
@@ -751,7 +747,6 @@ where
751747
}
752748
}
753749

754-
#[cfg(feature = "const-generics")]
755750
fn try_create_array<F, T, const N: usize>(mut cb: F) -> Result<[T; N]>
756751
where
757752
F: FnMut(usize) -> Result<T>,
@@ -771,7 +766,6 @@ where
771766
}
772767
}
773768

774-
#[cfg(feature = "const-generics")]
775769
impl<T, const N: usize> Arbitrary for [T; N]
776770
where
777771
T: Arbitrary,
@@ -803,91 +797,6 @@ where
803797
}
804798
}
805799

806-
#[cfg(not(feature = "const-generics"))]
807-
macro_rules! arbitrary_array {
808-
{$n:expr, ($t:ident, $a:ident) $(($ts:ident, $as:ident))*} => {
809-
arbitrary_array!{($n - 1), $(($ts, $as))*}
810-
811-
impl<T: Arbitrary> Arbitrary for [T; $n] {
812-
fn arbitrary(u: &mut Unstructured<'_>) -> Result<[T; $n]> {
813-
Ok([
814-
Arbitrary::arbitrary(u)?,
815-
$(<$ts as Arbitrary>::arbitrary(u)?),*
816-
])
817-
}
818-
819-
#[allow(unused_mut)]
820-
fn arbitrary_take_rest(mut u: Unstructured<'_>) -> Result<[T; $n]> {
821-
$(let $as = $ts::arbitrary(&mut u)?;)*
822-
let last = Arbitrary::arbitrary_take_rest(u)?;
823-
824-
Ok([
825-
$($as,)* last
826-
])
827-
}
828-
829-
#[inline]
830-
fn size_hint(depth: usize) -> (usize, Option<usize>) {
831-
crate::size_hint::and_all(&[
832-
<$t as Arbitrary>::size_hint(depth),
833-
$( <$ts as Arbitrary>::size_hint(depth) ),*
834-
])
835-
}
836-
837-
#[allow(unused_mut)] // For the `[T; 1]` case.
838-
fn shrink(&self) -> Box<dyn Iterator<Item = Self>> {
839-
let mut i = 0;
840-
let mut shrinkers = [
841-
self[i].shrink(),
842-
$({
843-
i += 1;
844-
let t: &$ts = &self[i];
845-
t.shrink()
846-
}),*
847-
];
848-
Box::new(iter::from_fn(move || {
849-
let mut i = 0;
850-
Some([
851-
shrinkers[i].next()?,
852-
$({
853-
i += 1;
854-
let t: $ts = shrinkers[i].next()?;
855-
t
856-
}),*
857-
])
858-
}))
859-
}
860-
}
861-
};
862-
($n: expr,) => {};
863-
}
864-
865-
#[cfg(not(feature = "const-generics"))]
866-
impl<T: Arbitrary> Arbitrary for [T; 0] {
867-
fn arbitrary(_: &mut Unstructured<'_>) -> Result<[T; 0]> {
868-
Ok([])
869-
}
870-
871-
fn arbitrary_take_rest(_: Unstructured<'_>) -> Result<[T; 0]> {
872-
Ok([])
873-
}
874-
875-
#[inline]
876-
fn size_hint(_: usize) -> (usize, Option<usize>) {
877-
crate::size_hint::and_all(&[])
878-
}
879-
880-
fn shrink(&self) -> Box<dyn Iterator<Item = Self>> {
881-
Box::new(iter::from_fn(|| None))
882-
}
883-
}
884-
#[cfg(not(feature = "const-generics"))]
885-
arbitrary_array! { 32, (T, a) (T, b) (T, c) (T, d) (T, e) (T, f) (T, g) (T, h)
886-
(T, i) (T, j) (T, k) (T, l) (T, m) (T, n) (T, o) (T, p)
887-
(T, q) (T, r) (T, s) (T, u) (T, v) (T, w) (T, x) (T, y)
888-
(T, z) (T, aa) (T, ab) (T, ac) (T, ad) (T, ae) (T, af)
889-
(T, ag) }
890-
891800
fn shrink_collection<'a, T, A: Arbitrary>(
892801
entries: impl Iterator<Item = T>,
893802
f: impl Fn(&T) -> Box<dyn Iterator<Item = A>>,

0 commit comments

Comments
 (0)