Skip to content

Commit

Permalink
Delete ArrayVecCopy::new_const since it doesn't work on Rust 1.51
Browse files Browse the repository at this point in the history
```
error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
  --> src/arrayvec_copy.rs:59:6
   |
59 | impl<T: Copy, const CAP: usize> ArrayVecCopy<T, CAP> {
   |      ^
   |
   = note: see issue #57563 <rust-lang/rust#57563> for more information
   = help: add `#![feature(const_fn)]` to the crate attributes to enable
```
  • Loading branch information
tbu- committed Oct 17, 2024
1 parent 4f348df commit 03fb484
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 16 deletions.
25 changes: 23 additions & 2 deletions src/arrayvec_copy.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/src/arrayvec_copy_generated.rs b/src/arrayvec_copy.rs
index b12aa9e..5597af9 100644
index b12aa9e..8e4c3a9 100644
--- a/src/arrayvec_copy_generated.rs
+++ b/src/arrayvec_copy.rs
@@ -27,6 +27,9 @@ use crate::utils::MakeMaybeUninit;
Expand Down Expand Up @@ -27,7 +27,28 @@ index b12aa9e..5597af9 100644
macro_rules! panic_oob {
($method_name:expr, $index:expr, $len:expr) => {
panic!(concat!("ArrayVecCopy::", $method_name, ": index {} is out of bounds in vector of length {}"),
@@ -964,21 +959,6 @@ impl<T: Copy, const CAP: usize> DoubleEndedIterator for IntoIter<T, CAP> {
@@ -87,20 +82,6 @@ impl<T: Copy, const CAP: usize> ArrayVecCopy<T, CAP> {
}
}

- /// Create a new empty `ArrayVecCopy` (const fn).
- ///
- /// The maximum capacity is given by the generic parameter `CAP`.
- ///
- /// ```
- /// use arrayvec::ArrayVecCopy;
- ///
- /// static ARRAY: ArrayVecCopy<u8, 1024> = ArrayVecCopy::new_const();
- /// ```
- pub const fn new_const() -> ArrayVecCopy<T, CAP> {
- assert_capacity_limit_const!(CAP);
- ArrayVecCopy { xs: MakeMaybeUninit::ARRAY, len: 0 }
- }
-
/// Return the number of elements in the `ArrayVecCopy`.
///
/// ```
@@ -964,21 +945,6 @@ impl<T: Copy, const CAP: usize> DoubleEndedIterator for IntoIter<T, CAP> {

impl<T: Copy, const CAP: usize> ExactSizeIterator for IntoIter<T, CAP> { }

Expand Down
14 changes: 0 additions & 14 deletions src/arrayvec_copy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,20 +82,6 @@ impl<T: Copy, const CAP: usize> ArrayVecCopy<T, CAP> {
}
}

/// Create a new empty `ArrayVecCopy` (const fn).
///
/// The maximum capacity is given by the generic parameter `CAP`.
///
/// ```
/// use arrayvec::ArrayVecCopy;
///
/// static ARRAY: ArrayVecCopy<u8, 1024> = ArrayVecCopy::new_const();
/// ```
pub const fn new_const() -> ArrayVecCopy<T, CAP> {
assert_capacity_limit_const!(CAP);
ArrayVecCopy { xs: MakeMaybeUninit::ARRAY, len: 0 }
}

/// Return the number of elements in the `ArrayVecCopy`.
///
/// ```
Expand Down

0 comments on commit 03fb484

Please sign in to comment.