diff options
| author | Roman Proskuryakov <humbug@deeptown.org> | 2020-07-05 15:02:01 +0300 |
|---|---|---|
| committer | Roman Proskuryakov <humbug@deeptown.org> | 2020-07-05 15:47:08 +0300 |
| commit | eff62069ad602090e8d27b83cffd9e77479ed4be (patch) | |
| tree | 6fb5ca35f019a29a7c41ce206d53c17968376c75 /src/test/ui/const-generics/array-impls | |
| parent | 7d4a92d4f8dc03409984695d78893fffdd3ff1f9 (diff) | |
| download | rust-eff62069ad602090e8d27b83cffd9e77479ed4be.tar.gz rust-eff62069ad602090e8d27b83cffd9e77479ed4be.zip | |
Remove the usage of the LengthAtMost32 trait
Diffstat (limited to 'src/test/ui/const-generics/array-impls')
12 files changed, 172 insertions, 512 deletions
diff --git a/src/test/ui/const-generics/array-impls/alloc-traits-impls-length-33.rs b/src/test/ui/const-generics/array-impls/alloc-traits-impls-length-33.rs new file mode 100644 index 00000000000..35df3278a6e --- /dev/null +++ b/src/test/ui/const-generics/array-impls/alloc-traits-impls-length-33.rs @@ -0,0 +1,40 @@ +// check-pass + +pub fn yes_vec_partial_eq_array<A, B>() -> impl PartialEq<[B; 33]> +where + A: PartialEq<B>, +{ + Vec::<A>::new() +} + +pub fn yes_vec_partial_eq_ref_array<'a, A, B>() -> impl PartialEq<&'a [B; 33]> +where + A: PartialEq<B>, +{ + Vec::<A>::new() +} + +use std::collections::VecDeque; + +pub fn yes_vecdeque_partial_eq_array<A, B>() -> impl PartialEq<[B; 33]> +where + A: PartialEq<B>, +{ + VecDeque::<A>::new() +} + +pub fn yes_vecdeque_partial_eq_ref_array<'a, A, B>() -> impl PartialEq<&'a [B; 33]> +where + A: PartialEq<B>, +{ + VecDeque::<A>::new() +} + +pub fn yes_vecdeque_partial_eq_ref_mut_array<'a, A, B>() -> impl PartialEq<&'a mut [B; 33]> +where + A: PartialEq<B>, +{ + VecDeque::<A>::new() +} + +fn main() {} diff --git a/src/test/ui/const-generics/array-impls/alloc-traits-no-impls-length-33.rs b/src/test/ui/const-generics/array-impls/alloc-traits-no-impls-length-33.rs deleted file mode 100644 index 19107e6bf16..00000000000 --- a/src/test/ui/const-generics/array-impls/alloc-traits-no-impls-length-33.rs +++ /dev/null @@ -1,43 +0,0 @@ -pub fn no_vec_partial_eq_array<A, B>() -> impl PartialEq<[B; 33]> -//~^ ERROR arrays only have std trait implementations for lengths 0..=32 -where - A: PartialEq<B>, -{ - Vec::<A>::new() -} - -pub fn no_vec_partial_eq_ref_array<'a, A, B>() -> impl PartialEq<&'a [B; 33]> -//~^ ERROR arrays only have std trait implementations for lengths 0..=32 -where - A: PartialEq<B>, -{ - Vec::<A>::new() -} - -use std::collections::VecDeque; - -pub fn no_vecdeque_partial_eq_array<A, B>() -> impl PartialEq<[B; 33]> -//~^ ERROR arrays only have std trait implementations for lengths 0..=32 -where - A: PartialEq<B>, -{ - VecDeque::<A>::new() -} - -pub fn no_vecdeque_partial_eq_ref_array<'a, A, B>() -> impl PartialEq<&'a [B; 33]> -//~^ ERROR arrays only have std trait implementations for lengths 0..=32 -where - A: PartialEq<B>, -{ - VecDeque::<A>::new() -} - -pub fn no_vecdeque_partial_eq_ref_mut_array<'a, A, B>() -> impl PartialEq<&'a mut [B; 33]> -//~^ ERROR arrays only have std trait implementations for lengths 0..=32 -where - A: PartialEq<B>, -{ - VecDeque::<A>::new() -} - -fn main() {} diff --git a/src/test/ui/const-generics/array-impls/alloc-traits-no-impls-length-33.stderr b/src/test/ui/const-generics/array-impls/alloc-traits-no-impls-length-33.stderr deleted file mode 100644 index 6e5afcdb8bb..00000000000 --- a/src/test/ui/const-generics/array-impls/alloc-traits-no-impls-length-33.stderr +++ /dev/null @@ -1,63 +0,0 @@ -error[E0277]: arrays only have std trait implementations for lengths 0..=32 - --> $DIR/alloc-traits-no-impls-length-33.rs:1:43 - | -LL | pub fn no_vec_partial_eq_array<A, B>() -> impl PartialEq<[B; 33]> - | ^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::array::LengthAtMost32` is not implemented for `[B; 33]` -... -LL | Vec::<A>::new() - | --------------- this returned value is of type `std::vec::Vec<A>` - | - = note: required because of the requirements on the impl of `std::cmp::PartialEq<[B; 33]>` for `std::vec::Vec<A>` - = note: the return type of a function must have a statically known size - -error[E0277]: arrays only have std trait implementations for lengths 0..=32 - --> $DIR/alloc-traits-no-impls-length-33.rs:9:51 - | -LL | pub fn no_vec_partial_eq_ref_array<'a, A, B>() -> impl PartialEq<&'a [B; 33]> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::array::LengthAtMost32` is not implemented for `[B; 33]` -... -LL | Vec::<A>::new() - | --------------- this returned value is of type `std::vec::Vec<A>` - | - = note: required because of the requirements on the impl of `std::cmp::PartialEq<&'a [B; 33]>` for `std::vec::Vec<A>` - = note: the return type of a function must have a statically known size - -error[E0277]: arrays only have std trait implementations for lengths 0..=32 - --> $DIR/alloc-traits-no-impls-length-33.rs:19:48 - | -LL | pub fn no_vecdeque_partial_eq_array<A, B>() -> impl PartialEq<[B; 33]> - | ^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::array::LengthAtMost32` is not implemented for `[B; 33]` -... -LL | VecDeque::<A>::new() - | -------------------- this returned value is of type `std::collections::VecDeque<A>` - | - = note: required because of the requirements on the impl of `std::cmp::PartialEq<[B; 33]>` for `std::collections::VecDeque<A>` - = note: the return type of a function must have a statically known size - -error[E0277]: arrays only have std trait implementations for lengths 0..=32 - --> $DIR/alloc-traits-no-impls-length-33.rs:27:56 - | -LL | pub fn no_vecdeque_partial_eq_ref_array<'a, A, B>() -> impl PartialEq<&'a [B; 33]> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::array::LengthAtMost32` is not implemented for `[B; 33]` -... -LL | VecDeque::<A>::new() - | -------------------- this returned value is of type `std::collections::VecDeque<A>` - | - = note: required because of the requirements on the impl of `std::cmp::PartialEq<&'a [B; 33]>` for `std::collections::VecDeque<A>` - = note: the return type of a function must have a statically known size - -error[E0277]: arrays only have std trait implementations for lengths 0..=32 - --> $DIR/alloc-traits-no-impls-length-33.rs:35:60 - | -LL | pub fn no_vecdeque_partial_eq_ref_mut_array<'a, A, B>() -> impl PartialEq<&'a mut [B; 33]> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::array::LengthAtMost32` is not implemented for `[B; 33]` -... -LL | VecDeque::<A>::new() - | -------------------- this returned value is of type `std::collections::VecDeque<A>` - | - = note: required because of the requirements on the impl of `std::cmp::PartialEq<&'a mut [B; 33]>` for `std::collections::VecDeque<A>` - = note: the return type of a function must have a statically known size - -error: aborting due to 5 previous errors - -For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/const-generics/array-impls/alloc-types-impls-length-33.rs b/src/test/ui/const-generics/array-impls/alloc-types-impls-length-33.rs new file mode 100644 index 00000000000..294b405e0ed --- /dev/null +++ b/src/test/ui/const-generics/array-impls/alloc-types-impls-length-33.rs @@ -0,0 +1,25 @@ +// check-pass + +use std::{convert::TryFrom, rc::Rc, sync::Arc}; + +pub fn yes_vec() { + let v: Vec<_> = [0; 33].into(); +} + +pub fn yes_box() { + let boxed_slice = Box::new([0; 33]) as Box<[i32]>; + let boxed_array = <Box<[i32; 33]>>::try_from(boxed_slice); + let boxed_slice = <Box<[i32]>>::from([0; 33]); +} + +pub fn yes_rc() { + let boxed_slice = Rc::new([0; 33]) as Rc<[i32]>; + let boxed_array = <Rc<[i32; 33]>>::try_from(boxed_slice); +} + +pub fn yes_arc() { + let boxed_slice = Arc::new([0; 33]) as Arc<[i32]>; + let boxed_array = <Arc<[i32; 33]>>::try_from(boxed_slice); +} + +fn main() {} diff --git a/src/test/ui/const-generics/array-impls/alloc-types-no-impls-length-33.rs b/src/test/ui/const-generics/array-impls/alloc-types-no-impls-length-33.rs deleted file mode 100644 index 48cf21d489a..00000000000 --- a/src/test/ui/const-generics/array-impls/alloc-types-no-impls-length-33.rs +++ /dev/null @@ -1,33 +0,0 @@ -// ignore-tidy-linelength - -use std::{convert::TryFrom, rc::Rc, sync::Arc}; - -pub fn no_vec() { - let v: Vec<_> = [0; 33].into(); - //~^ ERROR arrays only have std trait implementations for lengths 0..=32 -} - -pub fn no_box() { - let boxed_slice = Box::new([0; 33]) as Box<[i32]>; - let boxed_array = <Box<[i32; 33]>>::try_from(boxed_slice); - //~^ ERROR the trait bound `std::boxed::Box<[i32; 33]>: std::convert::From<std::boxed::Box<[i32]>>` is not satisfied - //~^^ ERROR the trait bound `std::boxed::Box<[i32; 33]>: std::convert::TryFrom<std::boxed::Box<[i32]>>` is not satisfied - let boxed_slice = <Box<[i32]>>::from([0; 33]); - //~^ 15:42: 15:49: arrays only have std trait implementations for lengths 0..=32 [E0277] -} - -pub fn no_rc() { - let boxed_slice = Rc::new([0; 33]) as Rc<[i32]>; - let boxed_array = <Rc<[i32; 33]>>::try_from(boxed_slice); - //~^ ERROR the trait bound `std::rc::Rc<[i32; 33]>: std::convert::From<std::rc::Rc<[i32]>>` is not satisfied - //~^^ ERROR the trait bound `std::rc::Rc<[i32; 33]>: std::convert::TryFrom<std::rc::Rc<[i32]>>` is not satisfied -} - -pub fn no_arc() { - let boxed_slice = Arc::new([0; 33]) as Arc<[i32]>; - let boxed_array = <Arc<[i32; 33]>>::try_from(boxed_slice); - //~^ ERROR the trait bound `std::sync::Arc<[i32; 33]>: std::convert::From<std::sync::Arc<[i32]>>` is not satisfied - //~^^ ERROR the trait bound `std::sync::Arc<[i32; 33]>: std::convert::TryFrom<std::sync::Arc<[i32]>>` is not satisfied -} - -fn main() {} diff --git a/src/test/ui/const-generics/array-impls/alloc-types-no-impls-length-33.stderr b/src/test/ui/const-generics/array-impls/alloc-types-no-impls-length-33.stderr deleted file mode 100644 index 5c01603ab88..00000000000 --- a/src/test/ui/const-generics/array-impls/alloc-types-no-impls-length-33.stderr +++ /dev/null @@ -1,97 +0,0 @@ -error[E0277]: arrays only have std trait implementations for lengths 0..=32 - --> $DIR/alloc-types-no-impls-length-33.rs:6:29 - | -LL | let v: Vec<_> = [0; 33].into(); - | ^^^^ the trait `std::array::LengthAtMost32` is not implemented for `[{integer}; 33]` - | - = note: required because of the requirements on the impl of `std::convert::From<[{integer}; 33]>` for `std::vec::Vec<{integer}>` - = note: required because of the requirements on the impl of `std::convert::Into<std::vec::Vec<{integer}>>` for `[{integer}; 33]` - -error[E0277]: the trait bound `std::boxed::Box<[i32; 33]>: std::convert::From<std::boxed::Box<[i32]>>` is not satisfied - --> $DIR/alloc-types-no-impls-length-33.rs:12:23 - | -LL | let boxed_array = <Box<[i32; 33]>>::try_from(boxed_slice); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::convert::From<std::boxed::Box<[i32]>>` is not implemented for `std::boxed::Box<[i32; 33]>` - | - = help: the following implementations were found: - <std::boxed::Box<(dyn std::error::Error + 'a)> as std::convert::From<E>> - <std::boxed::Box<(dyn std::error::Error + 'static)> as std::convert::From<&str>> - <std::boxed::Box<(dyn std::error::Error + 'static)> as std::convert::From<std::borrow::Cow<'a, str>>> - <std::boxed::Box<(dyn std::error::Error + 'static)> as std::convert::From<std::string::String>> - and 22 others - = note: required because of the requirements on the impl of `std::convert::Into<std::boxed::Box<[i32; 33]>>` for `std::boxed::Box<[i32]>` - = note: required because of the requirements on the impl of `std::convert::TryFrom<std::boxed::Box<[i32]>>` for `std::boxed::Box<[i32; 33]>` - -error[E0277]: arrays only have std trait implementations for lengths 0..=32 - --> $DIR/alloc-types-no-impls-length-33.rs:15:42 - | -LL | let boxed_slice = <Box<[i32]>>::from([0; 33]); - | ^^^^^^^ - | | - | expected an implementor of trait `std::convert::From<[{integer}; 33]>` - | help: consider borrowing here: `&[0; 33]` - | - = note: the trait bound `[i32; 33]: std::convert::From<[{integer}; 33]>` is not satisfied - = note: required because of the requirements on the impl of `std::convert::From<[i32; 33]>` for `std::boxed::Box<[i32]>` - = note: required by `std::convert::From::from` - -error[E0277]: the trait bound `std::boxed::Box<[i32; 33]>: std::convert::TryFrom<std::boxed::Box<[i32]>>` is not satisfied - --> $DIR/alloc-types-no-impls-length-33.rs:12:23 - | -LL | let boxed_array = <Box<[i32; 33]>>::try_from(boxed_slice); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::convert::TryFrom<std::boxed::Box<[i32]>>` is not implemented for `std::boxed::Box<[i32; 33]>` - | - = help: the following implementations were found: - <std::boxed::Box<[T; N]> as std::convert::TryFrom<std::boxed::Box<[T]>>> - -error[E0277]: the trait bound `std::rc::Rc<[i32; 33]>: std::convert::From<std::rc::Rc<[i32]>>` is not satisfied - --> $DIR/alloc-types-no-impls-length-33.rs:21:23 - | -LL | let boxed_array = <Rc<[i32; 33]>>::try_from(boxed_slice); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::convert::From<std::rc::Rc<[i32]>>` is not implemented for `std::rc::Rc<[i32; 33]>` - | - = help: the following implementations were found: - <std::rc::Rc<B> as std::convert::From<std::borrow::Cow<'a, B>>> - <std::rc::Rc<T> as std::convert::From<T>> - <std::rc::Rc<T> as std::convert::From<std::boxed::Box<T>>> - <std::rc::Rc<[T]> as std::convert::From<&[T]>> - and 9 others - = note: required because of the requirements on the impl of `std::convert::Into<std::rc::Rc<[i32; 33]>>` for `std::rc::Rc<[i32]>` - = note: required because of the requirements on the impl of `std::convert::TryFrom<std::rc::Rc<[i32]>>` for `std::rc::Rc<[i32; 33]>` - -error[E0277]: the trait bound `std::rc::Rc<[i32; 33]>: std::convert::TryFrom<std::rc::Rc<[i32]>>` is not satisfied - --> $DIR/alloc-types-no-impls-length-33.rs:21:23 - | -LL | let boxed_array = <Rc<[i32; 33]>>::try_from(boxed_slice); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::convert::TryFrom<std::rc::Rc<[i32]>>` is not implemented for `std::rc::Rc<[i32; 33]>` - | - = help: the following implementations were found: - <std::rc::Rc<[T; N]> as std::convert::TryFrom<std::rc::Rc<[T]>>> - -error[E0277]: the trait bound `std::sync::Arc<[i32; 33]>: std::convert::From<std::sync::Arc<[i32]>>` is not satisfied - --> $DIR/alloc-types-no-impls-length-33.rs:28:23 - | -LL | let boxed_array = <Arc<[i32; 33]>>::try_from(boxed_slice); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::convert::From<std::sync::Arc<[i32]>>` is not implemented for `std::sync::Arc<[i32; 33]>` - | - = help: the following implementations were found: - <std::sync::Arc<B> as std::convert::From<std::borrow::Cow<'a, B>>> - <std::sync::Arc<T> as std::convert::From<T>> - <std::sync::Arc<T> as std::convert::From<std::boxed::Box<T>>> - <std::sync::Arc<[T]> as std::convert::From<&[T]>> - and 9 others - = note: required because of the requirements on the impl of `std::convert::Into<std::sync::Arc<[i32; 33]>>` for `std::sync::Arc<[i32]>` - = note: required because of the requirements on the impl of `std::convert::TryFrom<std::sync::Arc<[i32]>>` for `std::sync::Arc<[i32; 33]>` - -error[E0277]: the trait bound `std::sync::Arc<[i32; 33]>: std::convert::TryFrom<std::sync::Arc<[i32]>>` is not satisfied - --> $DIR/alloc-types-no-impls-length-33.rs:28:23 - | -LL | let boxed_array = <Arc<[i32; 33]>>::try_from(boxed_slice); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::convert::TryFrom<std::sync::Arc<[i32]>>` is not implemented for `std::sync::Arc<[i32; 33]>` - | - = help: the following implementations were found: - <std::sync::Arc<[T; N]> as std::convert::TryFrom<std::sync::Arc<[T]>>> - -error: aborting due to 8 previous errors - -For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/const-generics/array-impls/core-traits-impls-length-33.rs b/src/test/ui/const-generics/array-impls/core-traits-impls-length-33.rs new file mode 100644 index 00000000000..c609a7c6f92 --- /dev/null +++ b/src/test/ui/const-generics/array-impls/core-traits-impls-length-33.rs @@ -0,0 +1,66 @@ +// check-pass + +pub fn yes_as_ref() -> impl AsRef<[u8]> { + [0; 33] +} + +pub fn yes_as_mut() -> impl AsMut<[u8]> { + [0; 33] +} + +pub fn yes_borrow() -> impl std::borrow::Borrow<[u8]> { + [0; 33] +} + +pub fn yes_borrow_mut() -> impl std::borrow::BorrowMut<[u8]> { + [0; 33] +} + +pub fn yes_try_from_slice() -> impl std::convert::TryFrom<&'static [u8]> { + [0; 33] +} + +pub fn yes_ref_try_from_slice() -> impl std::convert::TryFrom<&'static [u8]> { + let a: &'static _ = &[0; 33]; + a +} + +pub fn yes_hash() -> impl std::hash::Hash { + [0; 33] +} + +pub fn yes_debug() -> impl std::fmt::Debug { + [0; 33] +} + +pub fn yes_ref_into_iterator() -> impl IntoIterator<Item=&'static u8> { + let a: &'static _ = &[0; 33]; + a +} + +pub fn yes_partial_eq() -> impl PartialEq<[u8; 33]> { + [0; 33] +} + +pub fn yes_partial_eq_slice() -> impl PartialEq<[u8]> { + [0; 33] +} + +pub fn yes_slice_partial_eq() -> impl PartialEq<[u8; 33]> { + let a: &'static _ = &[0; 33]; + &a[..] +} + +pub fn yes_eq() -> impl Eq { + [0; 33] +} + +pub fn yes_partial_ord() -> impl PartialOrd<[u8; 33]> { + [0; 33] +} + +pub fn yes_ord() -> impl Ord { + [0; 33] +} + +fn main() {} diff --git a/src/test/ui/const-generics/array-impls/core-traits-no-impls-length-33.rs b/src/test/ui/const-generics/array-impls/core-traits-no-impls-length-33.rs deleted file mode 100644 index 8397d204f35..00000000000 --- a/src/test/ui/const-generics/array-impls/core-traits-no-impls-length-33.rs +++ /dev/null @@ -1,29 +0,0 @@ -pub fn no_debug() { - println!("{:?}", [0_usize; 33]); - //~^ ERROR arrays only have std trait implementations for lengths 0..=32 -} - -pub fn no_hash() { - use std::collections::HashSet; - let mut set = HashSet::new(); - set.insert([0_usize; 33]); - //~^ ERROR arrays only have std trait implementations for lengths 0..=32 -} - -pub fn no_partial_eq() -> bool { - [0_usize; 33] == [1_usize; 33] - //~^ ERROR binary operation `==` cannot be applied to type `[usize; 33]` -} - -pub fn no_partial_ord() -> bool { - [0_usize; 33] < [1_usize; 33] - //~^ ERROR binary operation `<` cannot be applied to type `[usize; 33]` -} - -pub fn no_into_iterator() { - for _ in &[0_usize; 33] { - //~^ ERROR the trait bound `&[usize; 33]: std::iter::IntoIterator` is not satisfied - } -} - -fn main() {} diff --git a/src/test/ui/const-generics/array-impls/core-traits-no-impls-length-33.stderr b/src/test/ui/const-generics/array-impls/core-traits-no-impls-length-33.stderr deleted file mode 100644 index 76ccc48c32a..00000000000 --- a/src/test/ui/const-generics/array-impls/core-traits-no-impls-length-33.stderr +++ /dev/null @@ -1,51 +0,0 @@ -error[E0277]: arrays only have std trait implementations for lengths 0..=32 - --> $DIR/core-traits-no-impls-length-33.rs:2:22 - | -LL | println!("{:?}", [0_usize; 33]); - | ^^^^^^^^^^^^^ the trait `std::array::LengthAtMost32` is not implemented for `[usize; 33]` - | - = note: required because of the requirements on the impl of `std::fmt::Debug` for `[usize; 33]` - = note: required by `std::fmt::Debug::fmt` - = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: arrays only have std trait implementations for lengths 0..=32 - --> $DIR/core-traits-no-impls-length-33.rs:9:16 - | -LL | set.insert([0_usize; 33]); - | ^^^^^^^^^^^^^ the trait `std::array::LengthAtMost32` is not implemented for `[usize; 33]` - | - = note: required because of the requirements on the impl of `std::cmp::Eq` for `[usize; 33]` - -error[E0369]: binary operation `==` cannot be applied to type `[usize; 33]` - --> $DIR/core-traits-no-impls-length-33.rs:14:19 - | -LL | [0_usize; 33] == [1_usize; 33] - | ------------- ^^ ------------- [usize; 33] - | | - | [usize; 33] - -error[E0369]: binary operation `<` cannot be applied to type `[usize; 33]` - --> $DIR/core-traits-no-impls-length-33.rs:19:19 - | -LL | [0_usize; 33] < [1_usize; 33] - | ------------- ^ ------------- [usize; 33] - | | - | [usize; 33] - -error[E0277]: the trait bound `&[usize; 33]: std::iter::IntoIterator` is not satisfied - --> $DIR/core-traits-no-impls-length-33.rs:24:14 - | -LL | for _ in &[0_usize; 33] { - | ^^^^^^^^^^^^^^ the trait `std::iter::IntoIterator` is not implemented for `&[usize; 33]` - | - = help: the following implementations were found: - <&'a [T; N] as std::iter::IntoIterator> - <&'a [T] as std::iter::IntoIterator> - <&'a mut [T; N] as std::iter::IntoIterator> - <&'a mut [T] as std::iter::IntoIterator> - = note: required by `std::iter::IntoIterator::into_iter` - -error: aborting due to 5 previous errors - -Some errors have detailed explanations: E0277, E0369. -For more information about an error, try `rustc --explain E0277`. diff --git a/src/test/ui/const-generics/array-impls/into-iter-impls-length-33.rs b/src/test/ui/const-generics/array-impls/into-iter-impls-length-33.rs new file mode 100644 index 00000000000..0aeba8607e8 --- /dev/null +++ b/src/test/ui/const-generics/array-impls/into-iter-impls-length-33.rs @@ -0,0 +1,41 @@ +// check-pass + +#![feature(array_value_iter)] +#![feature(trusted_len)] + +use std::{ + array::IntoIter, + fmt::Debug, + iter::{ExactSizeIterator, FusedIterator, TrustedLen}, +}; + +pub fn yes_iterator() -> impl Iterator<Item = i32> { + IntoIter::new([0i32; 32]) +} + +pub fn yes_double_ended_iterator() -> impl DoubleEndedIterator { + IntoIter::new([0i32; 32]) +} + +pub fn yes_exact_size_iterator() -> impl ExactSizeIterator { + IntoIter::new([0i32; 32]) +} + +pub fn yes_fused_iterator() -> impl FusedIterator { + IntoIter::new([0i32; 32]) +} + +pub fn yes_trusted_len() -> impl TrustedLen { + IntoIter::new([0i32; 32]) +} + +pub fn yes_clone() -> impl Clone { + IntoIter::new([0i32; 32]) +} + +pub fn yes_debug() -> impl Debug { + IntoIter::new([0i32; 32]) +} + + +fn main() {} diff --git a/src/test/ui/const-generics/array-impls/into-iter-no-impls-length-33.rs b/src/test/ui/const-generics/array-impls/into-iter-no-impls-length-33.rs deleted file mode 100644 index a0bbd2ce64a..00000000000 --- a/src/test/ui/const-generics/array-impls/into-iter-no-impls-length-33.rs +++ /dev/null @@ -1,53 +0,0 @@ -#![feature(array_value_iter)] -#![feature(trusted_len)] - -use std::{ - array::IntoIter, - fmt::Debug, - iter::{ExactSizeIterator, FusedIterator, TrustedLen}, -}; - -pub fn no_iterator() -> impl Iterator<Item = i32> { - //~^ ERROR arrays only have std trait implementations for lengths 0..=32 - IntoIter::new([0i32; 33]) - //~^ ERROR arrays only have std trait implementations for lengths 0..=32 -} - -pub fn no_double_ended_iterator() -> impl DoubleEndedIterator { - //~^ ERROR arrays only have std trait implementations for lengths 0..=32 - IntoIter::new([0i32; 33]) - //~^ ERROR arrays only have std trait implementations for lengths 0..=32 -} - -pub fn no_exact_size_iterator() -> impl ExactSizeIterator { - //~^ ERROR arrays only have std trait implementations for lengths 0..=32 - IntoIter::new([0i32; 33]) - //~^ ERROR arrays only have std trait implementations for lengths 0..=32 -} - -pub fn no_fused_iterator() -> impl FusedIterator { - //~^ ERROR arrays only have std trait implementations for lengths 0..=32 - IntoIter::new([0i32; 33]) - //~^ ERROR arrays only have std trait implementations for lengths 0..=32 -} - -pub fn no_trusted_len() -> impl TrustedLen { - //~^ ERROR arrays only have std trait implementations for lengths 0..=32 - IntoIter::new([0i32; 33]) - //~^ ERROR arrays only have std trait implementations for lengths 0..=32 -} - -pub fn no_clone() -> impl Clone { - //~^ ERROR arrays only have std trait implementations for lengths 0..=32 - IntoIter::new([0i32; 33]) - //~^ ERROR arrays only have std trait implementations for lengths 0..=32 -} - -pub fn no_debug() -> impl Debug { - //~^ ERROR arrays only have std trait implementations for lengths 0..=32 - IntoIter::new([0i32; 33]) - //~^ ERROR arrays only have std trait implementations for lengths 0..=32 -} - - -fn main() {} diff --git a/src/test/ui/const-generics/array-impls/into-iter-no-impls-length-33.stderr b/src/test/ui/const-generics/array-impls/into-iter-no-impls-length-33.stderr deleted file mode 100644 index ceda31550ff..00000000000 --- a/src/test/ui/const-generics/array-impls/into-iter-no-impls-length-33.stderr +++ /dev/null @@ -1,143 +0,0 @@ -error[E0277]: arrays only have std trait implementations for lengths 0..=32 - --> $DIR/into-iter-no-impls-length-33.rs:12:19 - | -LL | IntoIter::new([0i32; 33]) - | ^^^^^^^^^^ the trait `std::array::LengthAtMost32` is not implemented for `[i32; 33]` - | - = note: required by `std::array::IntoIter::<T, N>::new` - -error[E0277]: arrays only have std trait implementations for lengths 0..=32 - --> $DIR/into-iter-no-impls-length-33.rs:10:25 - | -LL | pub fn no_iterator() -> impl Iterator<Item = i32> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::array::LengthAtMost32` is not implemented for `[i32; 33]` -LL | -LL | IntoIter::new([0i32; 33]) - | ------------------------- this returned value is of type `std::array::IntoIter<i32, 33_usize>` - | - = note: required because of the requirements on the impl of `std::iter::Iterator` for `std::array::IntoIter<i32, 33_usize>` - = note: the return type of a function must have a statically known size - -error[E0277]: arrays only have std trait implementations for lengths 0..=32 - --> $DIR/into-iter-no-impls-length-33.rs:18:19 - | -LL | IntoIter::new([0i32; 33]) - | ^^^^^^^^^^ the trait `std::array::LengthAtMost32` is not implemented for `[i32; 33]` - | - = note: required by `std::array::IntoIter::<T, N>::new` - -error[E0277]: arrays only have std trait implementations for lengths 0..=32 - --> $DIR/into-iter-no-impls-length-33.rs:16:38 - | -LL | pub fn no_double_ended_iterator() -> impl DoubleEndedIterator { - | ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::array::LengthAtMost32` is not implemented for `[i32; 33]` -LL | -LL | IntoIter::new([0i32; 33]) - | ------------------------- this returned value is of type `std::array::IntoIter<i32, 33_usize>` - | - = note: required because of the requirements on the impl of `std::iter::DoubleEndedIterator` for `std::array::IntoIter<i32, 33_usize>` - = note: the return type of a function must have a statically known size - -error[E0277]: arrays only have std trait implementations for lengths 0..=32 - --> $DIR/into-iter-no-impls-length-33.rs:24:19 - | -LL | IntoIter::new([0i32; 33]) - | ^^^^^^^^^^ the trait `std::array::LengthAtMost32` is not implemented for `[i32; 33]` - | - = note: required by `std::array::IntoIter::<T, N>::new` - -error[E0277]: arrays only have std trait implementations for lengths 0..=32 - --> $DIR/into-iter-no-impls-length-33.rs:22:36 - | -LL | pub fn no_exact_size_iterator() -> impl ExactSizeIterator { - | ^^^^^^^^^^^^^^^^^^^^^^ the trait `std::array::LengthAtMost32` is not implemented for `[i32; 33]` -LL | -LL | IntoIter::new([0i32; 33]) - | ------------------------- this returned value is of type `std::array::IntoIter<i32, 33_usize>` - | - = note: required because of the requirements on the impl of `std::iter::ExactSizeIterator` for `std::array::IntoIter<i32, 33_usize>` - = note: the return type of a function must have a statically known size - -error[E0277]: arrays only have std trait implementations for lengths 0..=32 - --> $DIR/into-iter-no-impls-length-33.rs:30:19 - | -LL | IntoIter::new([0i32; 33]) - | ^^^^^^^^^^ the trait `std::array::LengthAtMost32` is not implemented for `[i32; 33]` - | - = note: required by `std::array::IntoIter::<T, N>::new` - -error[E0277]: arrays only have std trait implementations for lengths 0..=32 - --> $DIR/into-iter-no-impls-length-33.rs:28:31 - | -LL | pub fn no_fused_iterator() -> impl FusedIterator { - | ^^^^^^^^^^^^^^^^^^ the trait `std::array::LengthAtMost32` is not implemented for `[i32; 33]` -LL | -LL | IntoIter::new([0i32; 33]) - | ------------------------- this returned value is of type `std::array::IntoIter<i32, 33_usize>` - | - = note: required because of the requirements on the impl of `std::iter::FusedIterator` for `std::array::IntoIter<i32, 33_usize>` - = note: the return type of a function must have a statically known size - -error[E0277]: arrays only have std trait implementations for lengths 0..=32 - --> $DIR/into-iter-no-impls-length-33.rs:36:19 - | -LL | IntoIter::new([0i32; 33]) - | ^^^^^^^^^^ the trait `std::array::LengthAtMost32` is not implemented for `[i32; 33]` - | - = note: required by `std::array::IntoIter::<T, N>::new` - -error[E0277]: arrays only have std trait implementations for lengths 0..=32 - --> $DIR/into-iter-no-impls-length-33.rs:34:28 - | -LL | pub fn no_trusted_len() -> impl TrustedLen { - | ^^^^^^^^^^^^^^^ the trait `std::array::LengthAtMost32` is not implemented for `[i32; 33]` -LL | -LL | IntoIter::new([0i32; 33]) - | ------------------------- this returned value is of type `std::array::IntoIter<i32, 33_usize>` - | - = note: required because of the requirements on the impl of `std::iter::TrustedLen` for `std::array::IntoIter<i32, 33_usize>` - = note: the return type of a function must have a statically known size - -error[E0277]: arrays only have std trait implementations for lengths 0..=32 - --> $DIR/into-iter-no-impls-length-33.rs:42:19 - | -LL | IntoIter::new([0i32; 33]) - | ^^^^^^^^^^ the trait `std::array::LengthAtMost32` is not implemented for `[i32; 33]` - | - = note: required by `std::array::IntoIter::<T, N>::new` - -error[E0277]: arrays only have std trait implementations for lengths 0..=32 - --> $DIR/into-iter-no-impls-length-33.rs:40:22 - | -LL | pub fn no_clone() -> impl Clone { - | ^^^^^^^^^^ the trait `std::array::LengthAtMost32` is not implemented for `[i32; 33]` -LL | -LL | IntoIter::new([0i32; 33]) - | ------------------------- this returned value is of type `std::array::IntoIter<i32, 33_usize>` - | - = note: required because of the requirements on the impl of `std::clone::Clone` for `std::array::IntoIter<i32, 33_usize>` - = note: the return type of a function must have a statically known size - -error[E0277]: arrays only have std trait implementations for lengths 0..=32 - --> $DIR/into-iter-no-impls-length-33.rs:48:19 - | -LL | IntoIter::new([0i32; 33]) - | ^^^^^^^^^^ the trait `std::array::LengthAtMost32` is not implemented for `[i32; 33]` - | - = note: required by `std::array::IntoIter::<T, N>::new` - -error[E0277]: arrays only have std trait implementations for lengths 0..=32 - --> $DIR/into-iter-no-impls-length-33.rs:46:22 - | -LL | pub fn no_debug() -> impl Debug { - | ^^^^^^^^^^ the trait `std::array::LengthAtMost32` is not implemented for `[i32; 33]` -LL | -LL | IntoIter::new([0i32; 33]) - | ------------------------- this returned value is of type `std::array::IntoIter<i32, 33_usize>` - | - = note: required because of the requirements on the impl of `std::fmt::Debug` for `std::array::IntoIter<i32, 33_usize>` - = note: the return type of a function must have a statically known size - -error: aborting due to 14 previous errors - -For more information about this error, try `rustc --explain E0277`. |
