-
Notifications
You must be signed in to change notification settings - Fork 13.4k
In which we constantly improve the Vec(Deque) array PartialEq impls #63061
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
src/test/ui/const-generics/array-impls/alloc-traits-impls-length-32.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// check-pass | ||
|
||
pub fn yes_vec_partial_eq_array<A, B>() -> impl PartialEq<[B; 32]> | ||
where | ||
A: PartialEq<B>, | ||
{ | ||
Vec::<A>::new() | ||
} | ||
|
||
pub fn yes_vec_partial_eq_ref_array<'a, A, B>() -> impl PartialEq<&'a [B; 32]> | ||
where | ||
A: PartialEq<B>, | ||
{ | ||
Vec::<A>::new() | ||
} | ||
|
||
use std::collections::VecDeque; | ||
|
||
pub fn yes_vecdeque_partial_eq_array<A, B>() -> impl PartialEq<[B; 32]> | ||
where | ||
A: PartialEq<B>, | ||
{ | ||
VecDeque::<A>::new() | ||
} | ||
|
||
pub fn yes_vecdeque_partial_eq_ref_array<'a, A, B>() -> impl PartialEq<&'a [B; 32]> | ||
where | ||
A: PartialEq<B>, | ||
{ | ||
VecDeque::<A>::new() | ||
} | ||
|
||
pub fn yes_vecdeque_partial_eq_ref_mut_array<'a, A, B>() -> impl PartialEq<&'a mut [B; 32]> | ||
where | ||
A: PartialEq<B>, | ||
{ | ||
VecDeque::<A>::new() | ||
} | ||
|
||
fn main() {} |
43 changes: 43 additions & 0 deletions
43
src/test/ui/const-generics/array-impls/alloc-traits-no-impls-length-33.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
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() {} |
48 changes: 48 additions & 0 deletions
48
src/test/ui/const-generics/array-impls/alloc-traits-no-impls-length-33.stderr
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
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]` | ||
| | ||
= 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]` | ||
| | ||
= 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]` | ||
| | ||
= 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]` | ||
| | ||
= 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]` | ||
| | ||
= 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`. |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.