slightlyoutofphase/staticvec

Compilation fails on latest nightly (e77366b57 2023-05-16)

Skallwar opened this issue · 4 comments

Hi. Thanks for your crate.
I notice that staticvec is not building with latest nightly:

❯ rustc -V
rustc 1.71.0-nightly (e77366b57 2023-05-16)
❯ cargo build
    Updating crates.io index
   Compiling staticvec v0.11.9 (/home/esteban/dev/staticvec)
warning: the feature `const_ptr_read` has been stable since 1.71.0-nightly and no longer requires an attribute to enable
  --> src/lib.rs:45:3
   |
45 |   const_ptr_read,
   |   ^^^^^^^^^^^^^^
   |
   = note: `#[warn(stable_features)]` on by default

error: ~const can only be applied to `#[const_trait]` traits
    --> src/lib.rs:1420:26
     |
1420 |   where T: Copy + ~const PartialOrd {
     |                          ^^^^^^^^^^

error: ~const can only be applied to `#[const_trait]` traits
    --> src/lib.rs:1455:26
     |
1455 |   where T: Copy + ~const PartialOrd {
     |                          ^^^^^^^^^^

error: const `impl` for trait `Clone` which is not marked with `#[const_trait]`
  --> src/heap/heap_trait_impls.rs:25:37
   |
25 | impl<T: Copy, const N: usize> const Clone for StaticHeap<T, N> {
   |                                     ^^^^^
   |
   = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
   = note: adding a non-const method body in the future would be a breaking change

error: const `impl` for trait `Default` which is not marked with `#[const_trait]`
  --> src/heap/heap_trait_impls.rs:47:36
   |
47 | impl<T: Ord, const N: usize> const Default for StaticHeap<T, N> {
   |                                    ^^^^^^^
   |
   = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
   = note: adding a non-const method body in the future would be a breaking change

error: const `impl` for trait `IntoIterator` which is not marked with `#[const_trait]`
   --> src/heap/heap_trait_impls.rs:199:31
    |
199 | impl<T, const N: usize> const IntoIterator for StaticHeap<T, N> {
    |                               ^^^^^^^^^^^^
    |
    = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
    = note: adding a non-const method body in the future would be a breaking change

error: const `impl` for trait `IntoIterator` which is not marked with `#[const_trait]`
   --> src/heap/heap_trait_impls.rs:225:35
    |
225 | impl<'a, T, const N: usize> const IntoIterator for &'a StaticHeap<T, N> {
    |                                   ^^^^^^^^^^^^
    |
    = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
    = note: adding a non-const method body in the future would be a breaking change

error: const `impl` for trait `IntoIterator` which is not marked with `#[const_trait]`
   --> src/heap/heap_trait_impls.rs:235:35
    |
235 | impl<'a, T, const N: usize> const IntoIterator for &'a mut StaticHeap<T, N> {
    |                                   ^^^^^^^^^^^^
    |
    = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
    = note: adding a non-const method body in the future would be a breaking change

error: const `impl` for trait `From` which is not marked with `#[const_trait]`
  --> src/string/string_errors.rs:75:12
   |
75 | impl const From<DecodeUtf16Error> for StringError {
   |            ^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
   = note: adding a non-const method body in the future would be a breaking change

error: const `impl` for trait `From` which is not marked with `#[const_trait]`
  --> src/string/string_errors.rs:82:12
   |
82 | impl const From<Utf8Error> for StringError {
   |            ^^^^^^^^^^^^^^^
   |
   = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
   = note: adding a non-const method body in the future would be a breaking change

error: const `impl` for trait `From` which is not marked with `#[const_trait]`
  --> src/string/string_errors.rs:89:28
   |
89 | impl<const N: usize> const From<CapacityError<N>> for StringError {
   |                            ^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
   = note: adding a non-const method body in the future would be a breaking change

error: const `impl` for trait `AsMut` which is not marked with `#[const_trait]`
  --> src/string/string_trait_impls.rs:39:28
   |
39 | impl<const N: usize> const AsMut<str> for StaticString<N> {
   |                            ^^^^^^^^^^
   |
   = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
   = note: adding a non-const method body in the future would be a breaking change

error: const `impl` for trait `AsRef` which is not marked with `#[const_trait]`
  --> src/string/string_trait_impls.rs:46:28
   |
46 | impl<const N: usize> const AsRef<str> for StaticString<N> {
   |                            ^^^^^^^^^^
   |
   = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
   = note: adding a non-const method body in the future would be a breaking change

error: const `impl` for trait `AsRef` which is not marked with `#[const_trait]`
  --> src/string/string_trait_impls.rs:53:28
   |
53 | impl<const N: usize> const AsRef<[u8]> for StaticString<N> {
   |                            ^^^^^^^^^^^
   |
   = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
   = note: adding a non-const method body in the future would be a breaking change

error: const `impl` for trait `Borrow` which is not marked with `#[const_trait]`
  --> src/string/string_trait_impls.rs:60:28
   |
60 | impl<const N: usize> const Borrow<str> for StaticString<N> {
   |                            ^^^^^^^^^^^
   |
   = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
   = note: adding a non-const method body in the future would be a breaking change

error: const `impl` for trait `BorrowMut` which is not marked with `#[const_trait]`
  --> src/string/string_trait_impls.rs:67:28
   |
67 | impl<const N: usize> const BorrowMut<str> for StaticString<N> {
   |                            ^^^^^^^^^^^^^^
   |
   = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
   = note: adding a non-const method body in the future would be a breaking change

error: const `impl` for trait `Clone` which is not marked with `#[const_trait]`
  --> src/string/string_trait_impls.rs:74:28
   |
74 | impl<const N: usize> const Clone for StaticString<N> {
   |                            ^^^^^
   |
   = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
   = note: adding a non-const method body in the future would be a breaking change

error: const `impl` for trait `Default` which is not marked with `#[const_trait]`
   --> src/string/string_trait_impls.rs:106:28
    |
106 | impl<const N: usize> const Default for StaticString<N> {
    |                            ^^^^^^^
    |
    = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
    = note: adding a non-const method body in the future would be a breaking change

error: const `impl` for trait `Deref` which is not marked with `#[const_trait]`
   --> src/string/string_trait_impls.rs:113:28
    |
113 | impl<const N: usize> const Deref for StaticString<N> {
    |                            ^^^^^
    |
    = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
    = note: adding a non-const method body in the future would be a breaking change

error: const `impl` for trait `DerefMut` which is not marked with `#[const_trait]`
   --> src/string/string_trait_impls.rs:122:28
    |
122 | impl<const N: usize> const DerefMut for StaticString<N> {
    |                            ^^^^^^^^
    |
    = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
    = note: adding a non-const method body in the future would be a breaking change

error: const `impl` for trait `Index` which is not marked with `#[const_trait]`
   --> src/string/string_trait_impls.rs:262:28
    |
262 | impl<const N: usize> const Index<RangeFull> for StaticString<N> {
    |                            ^^^^^^^^^^^^^^^^
    |
    = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
    = note: adding a non-const method body in the future would be a breaking change

error: const `impl` for trait `IndexMut` which is not marked with `#[const_trait]`
   --> src/string/string_trait_impls.rs:271:28
    |
271 | impl<const N: usize> const IndexMut<RangeFull> for StaticString<N> {
    |                            ^^^^^^^^^^^^^^^^^^^
    |
    = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
    = note: adding a non-const method body in the future would be a breaking change

error: const `impl` for trait `AsMut` which is not marked with `#[const_trait]`
  --> src/trait_impls.rs:47:31
   |
47 | impl<T, const N: usize> const AsMut<[T]> for StaticVec<T, N> {
   |                               ^^^^^^^^^^
   |
   = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
   = note: adding a non-const method body in the future would be a breaking change

error: const `impl` for trait `AsRef` which is not marked with `#[const_trait]`
  --> src/trait_impls.rs:54:31
   |
54 | impl<T, const N: usize> const AsRef<[T]> for StaticVec<T, N> {
   |                               ^^^^^^^^^^
   |
   = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
   = note: adding a non-const method body in the future would be a breaking change

error: const `impl` for trait `Borrow` which is not marked with `#[const_trait]`
  --> src/trait_impls.rs:61:31
   |
61 | impl<T, const N: usize> const Borrow<[T]> for StaticVec<T, N> {
   |                               ^^^^^^^^^^^
   |
   = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
   = note: adding a non-const method body in the future would be a breaking change

error: const `impl` for trait `BorrowMut` which is not marked with `#[const_trait]`
  --> src/trait_impls.rs:68:31
   |
68 | impl<T, const N: usize> const BorrowMut<[T]> for StaticVec<T, N> {
   |                               ^^^^^^^^^^^^^^
   |
   = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
   = note: adding a non-const method body in the future would be a breaking change

error: const `impl` for trait `Clone` which is not marked with `#[const_trait]`
   --> src/trait_impls.rs:112:37
    |
112 | impl<T: Copy, const N: usize> const Clone for StaticVec<T, N> {
    |                                     ^^^^^
    |
    = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
    = note: adding a non-const method body in the future would be a breaking change

error: const `impl` for trait `Default` which is not marked with `#[const_trait]`
   --> src/trait_impls.rs:153:31
    |
153 | impl<T, const N: usize> const Default for StaticVec<T, N> {
    |                               ^^^^^^^
    |
    = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
    = note: adding a non-const method body in the future would be a breaking change

error: const `impl` for trait `Deref` which is not marked with `#[const_trait]`
   --> src/trait_impls.rs:161:31
    |
161 | impl<T, const N: usize> const Deref for StaticVec<T, N> {
    |                               ^^^^^
    |
    = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
    = note: adding a non-const method body in the future would be a breaking change

error: const `impl` for trait `DerefMut` which is not marked with `#[const_trait]`
   --> src/trait_impls.rs:169:31
    |
169 | impl<T, const N: usize> const DerefMut for StaticVec<T, N> {
    |                               ^^^^^^^^
    |
    = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
    = note: adding a non-const method body in the future would be a breaking change

error: const `impl` for trait `From` which is not marked with `#[const_trait]`
   --> src/trait_impls.rs:362:37
    |
362 | impl<T: Copy, const N: usize> const From<&[T]> for StaticVec<T, N> {
    |                                     ^^^^^^^^^^
    |
    = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
    = note: adding a non-const method body in the future would be a breaking change

error: const `impl` for trait `From` which is not marked with `#[const_trait]`
   --> src/trait_impls.rs:371:37
    |
371 | impl<T: Copy, const N: usize> const From<&mut [T]> for StaticVec<T, N> {
    |                                     ^^^^^^^^^^^^^^
    |
    = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
    = note: adding a non-const method body in the future would be a breaking change

error: const `impl` for trait `From` which is not marked with `#[const_trait]`
   --> src/trait_impls.rs:389:31
    |
389 | impl<T, const N: usize> const From<[T; N]> for StaticVec<T, N> {
    |                               ^^^^^^^^^^^^
    |
    = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
    = note: adding a non-const method body in the future would be a breaking change

error: const `impl` for trait `From` which is not marked with `#[const_trait]`
   --> src/trait_impls.rs:396:55
    |
396 | impl<T: Copy, const N1: usize, const N2: usize> const From<&[T; N1]> for StaticVec<T, N2> {
    |                                                       ^^^^^^^^^^^^^^
    |
    = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
    = note: adding a non-const method body in the future would be a breaking change

error: const `impl` for trait `From` which is not marked with `#[const_trait]`
   --> src/trait_impls.rs:405:37
    |
405 | impl<T: Copy, const N: usize> const From<&[T; N]> for StaticVec<T, N> {
    |                                     ^^^^^^^^^^^^^
    |
    = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
    = note: adding a non-const method body in the future would be a breaking change

error: const `impl` for trait `From` which is not marked with `#[const_trait]`
   --> src/trait_impls.rs:414:55
    |
414 | impl<T: Copy, const N1: usize, const N2: usize> const From<&mut [T; N1]> for StaticVec<T, N2> {
    |                                                       ^^^^^^^^^^^^^^^^^^
    |
    = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
    = note: adding a non-const method body in the future would be a breaking change

error: const `impl` for trait `From` which is not marked with `#[const_trait]`
   --> src/trait_impls.rs:423:37
    |
423 | impl<T: Copy, const N: usize> const From<&mut [T; N]> for StaticVec<T, N> {
    |                                     ^^^^^^^^^^^^^^^^^
    |
    = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
    = note: adding a non-const method body in the future would be a breaking change

error: const `impl` for trait `Index` which is not marked with `#[const_trait]`
   --> src/trait_impls.rs:495:31
    |
495 | impl<T, const N: usize> const Index<usize> for StaticVec<T, N> {
    |                               ^^^^^^^^^^^^
    |
    = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
    = note: adding a non-const method body in the future would be a breaking change

error: const `impl` for trait `IndexMut` which is not marked with `#[const_trait]`
   --> src/trait_impls.rs:518:31
    |
518 | impl<T, const N: usize> const IndexMut<usize> for StaticVec<T, N> {
    |                               ^^^^^^^^^^^^^^^
    |
    = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
    = note: adding a non-const method body in the future would be a breaking change

error: const `impl` for trait `Index` which is not marked with `#[const_trait]`
   --> src/trait_impls.rs:540:31
    |
540 | impl<T, const N: usize> const Index<Range<usize>> for StaticVec<T, N> {
    |                               ^^^^^^^^^^^^^^^^^^^
    |
    = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
    = note: adding a non-const method body in the future would be a breaking change

error: const `impl` for trait `IndexMut` which is not marked with `#[const_trait]`
   --> src/trait_impls.rs:554:31
    |
554 | impl<T, const N: usize> const IndexMut<Range<usize>> for StaticVec<T, N> {
    |                               ^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
    = note: adding a non-const method body in the future would be a breaking change

error: const `impl` for trait `Index` which is not marked with `#[const_trait]`
   --> src/trait_impls.rs:572:31
    |
572 | impl<T, const N: usize> const Index<RangeFrom<usize>> for StaticVec<T, N> {
    |                               ^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
    = note: adding a non-const method body in the future would be a breaking change

error: const `impl` for trait `IndexMut` which is not marked with `#[const_trait]`
   --> src/trait_impls.rs:589:31
    |
589 | impl<T, const N: usize> const IndexMut<RangeFrom<usize>> for StaticVec<T, N> {
    |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
    = note: adding a non-const method body in the future would be a breaking change

error: const `impl` for trait `Index` which is not marked with `#[const_trait]`
   --> src/trait_impls.rs:605:31
    |
605 | impl<T, const N: usize> const Index<RangeFull> for StaticVec<T, N> {
    |                               ^^^^^^^^^^^^^^^^
    |
    = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
    = note: adding a non-const method body in the future would be a breaking change

error: const `impl` for trait `IndexMut` which is not marked with `#[const_trait]`
   --> src/trait_impls.rs:615:31
    |
615 | impl<T, const N: usize> const IndexMut<RangeFull> for StaticVec<T, N> {
    |                               ^^^^^^^^^^^^^^^^^^^
    |
    = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
    = note: adding a non-const method body in the future would be a breaking change

error: const `impl` for trait `Index` which is not marked with `#[const_trait]`
   --> src/trait_impls.rs:624:31
    |
624 | impl<T, const N: usize> const Index<RangeInclusive<usize>> for StaticVec<T, N> {
    |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
    = note: adding a non-const method body in the future would be a breaking change

error: const `impl` for trait `IndexMut` which is not marked with `#[const_trait]`
   --> src/trait_impls.rs:638:31
    |
638 | impl<T, const N: usize> const IndexMut<RangeInclusive<usize>> for StaticVec<T, N> {
    |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
    = note: adding a non-const method body in the future would be a breaking change

error: const `impl` for trait `Index` which is not marked with `#[const_trait]`
   --> src/trait_impls.rs:651:31
    |
651 | impl<T, const N: usize> const Index<RangeTo<usize>> for StaticVec<T, N> {
    |                               ^^^^^^^^^^^^^^^^^^^^^
    |
    = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
    = note: adding a non-const method body in the future would be a breaking change

error: const `impl` for trait `IndexMut` which is not marked with `#[const_trait]`
   --> src/trait_impls.rs:663:31
    |
663 | impl<T, const N: usize> const IndexMut<RangeTo<usize>> for StaticVec<T, N> {
    |                               ^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
    = note: adding a non-const method body in the future would be a breaking change

error: const `impl` for trait `Index` which is not marked with `#[const_trait]`
   --> src/trait_impls.rs:674:31
    |
674 | impl<T, const N: usize> const Index<RangeToInclusive<usize>> for StaticVec<T, N> {
    |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
    = note: adding a non-const method body in the future would be a breaking change

error: const `impl` for trait `IndexMut` which is not marked with `#[const_trait]`
   --> src/trait_impls.rs:686:31
    |
686 | impl<T, const N: usize> const IndexMut<RangeToInclusive<usize>> for StaticVec<T, N> {
    |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
    = note: adding a non-const method body in the future would be a breaking change

error: const `impl` for trait `IntoIterator` which is not marked with `#[const_trait]`
   --> src/trait_impls.rs:708:39
    |
708 | impl<'a, T: 'a, const N: usize> const IntoIterator for &'a StaticVec<T, N> {
    |                                       ^^^^^^^^^^^^
    |
    = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
    = note: adding a non-const method body in the future would be a breaking change

error: const `impl` for trait `IntoIterator` which is not marked with `#[const_trait]`
   --> src/trait_impls.rs:719:39
    |
719 | impl<'a, T: 'a, const N: usize> const IntoIterator for &'a mut StaticVec<T, N> {
    |                                       ^^^^^^^^^^^^
    |
    = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
    = note: adding a non-const method body in the future would be a breaking change

error: const `impl` for trait `IntoIterator` which is not marked with `#[const_trait]`
   --> src/trait_impls.rs:730:31
    |
730 | impl<T, const N: usize> const IntoIterator for StaticVec<T, N> {
    |                               ^^^^^^^^^^^^
    |
    = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
    = note: adding a non-const method body in the future would be a breaking change

error: ~const can only be applied to `#[const_trait]` traits
   --> src/utils.rs:177:57
    |
177 | pub(crate) const fn quicksort_internal<T: Copy + ~const PartialOrd>(
    |                                                         ^^^^^^^^^^

warning: `staticvec` (lib) generated 1 warning
error: could not compile `staticvec` (lib) due to 54 previous errors; 1 warning emitted

I'm intending to get this all updated soon.

I actually cannot restore the intended functionality currently, due to this unexpected development:
rust-lang/rust#110395

There's no point in me publishing a modified version without all this stuff as it would be kind of a big regression, so I unfortunately have to just recommend using a nightly compiler version from prior to the change I linked above, for the time being.

I will update to whatever the new syntax is and publish a new version on crates.io as soon as it is possible to do so.

Thanks for your help on this!

Compilation still fails on the latest nightly (2024-05-09). :(