Repository navigation
Conversation
|
|
This comment has been minimized.
This comment has been minimized.
f03b9bb to
7c6adb3
Compare
This comment has been minimized.
This comment has been minimized.
- `[u8; N]` now print as `[1, 2, 3]` instead of `*b"..."` - For consistency, `&[u8]` now prints as `&[1, 2, 3]` too. This fixed internal structs being displayed for non `u8` slices.
7c6adb3 to
75fb503
Compare
|
Covered point 3 of #162851 too I just made the new error head be "array lenght mismatch" and made the error hold a |
There was a problem hiding this comment.
Can you move this into the else block below? That's the only place it's used.
| let (msg, terr) = if let ty::Array(ct_elem_ty, ct_len) = ct_ty.kind() | ||
| && let ty::Array(expected_elem_ty, expected_len) = expected_ty.kind() | ||
| && ct_elem_ty == expected_elem_ty | ||
| && ct_len != expected_len |
There was a problem hiding this comment.
Can be removed
| && ct_len != expected_len |
|
|
||
| const X4: &[u8; usize::MAX] = b""; | ||
| //~^ ERROR the constant `&*b""` is not of type `&'static [u8; usize::MAX]` | ||
| //~^ ERROR the constant `&[]` is not of type `&'static [u8; usize::MAX]` |
There was a problem hiding this comment.
hmm... we are not covering ref to arrays. Lets do it.
There was a problem hiding this comment.
does just calling peel_ref() on both work? or is it better to verify they have the same number of references, so that comparing &[u8; 2] and [u8; 3] wouldn't complain about the length of the array first? (though that seems like a niche case, but i prefer asking)
I'll do the peel ref for now in case it's the right call (for CI, might as well)
There was a problem hiding this comment.
nvmd i thought it was giving me the array length mismatch error when I compared a ref and an array but not at all. So, it works fine
3c82515 to
f1b4f6e
Compare
f1b4f6e to
899fb90
Compare
|
thanks for the PR!
not sure if you saw what oli said in zulip, but:
that seems reasonable to me @rustbot author |
|
Reminder, once the PR becomes ready for a review, use |
Point 1 of #162851
I just deleted the match arm that made
[u8; N]display as*b"..."The only "regression" is that consts written as byte strings also display as arrays but well, this seems like a smaller use case than arrays? I thought about conditionally writing it as a byte string if the bytes were ASCII but
[42]would then display as*b"*"which is not very readable either.Also, for consistency, I also made
u8slices display as lists. This had the additional consequence of fixing a bug where a mismatch in slice content would display an error exposing some internal structs:Vs now:
r? khyperia