Add a test for tuple_array_conversion
This commit is contained in:
parent
e35eb91a33
commit
f0eaa66263
@ -82,6 +82,11 @@ fn main() {
|
||||
[a, c];
|
||||
let [[a, b], [c, d]] = [[1, 2], [3, 4]];
|
||||
(a, c);
|
||||
// Array length is not usize (#11144)
|
||||
fn generic_array_length<const N: usize>() {
|
||||
let src = [0; N];
|
||||
let dest: (u8,) = (src[0],);
|
||||
}
|
||||
}
|
||||
|
||||
#[clippy::msrv = "1.70.0"]
|
||||
|
@ -64,7 +64,7 @@ LL | (src, dest);
|
||||
= help: use `.into()` instead, or `<(T0, T1, ..., Tn)>::from` if type annotations are needed
|
||||
|
||||
error: it looks like you're trying to convert an array to a tuple
|
||||
--> $DIR/tuple_array_conversions.rs:99:13
|
||||
--> $DIR/tuple_array_conversions.rs:104:13
|
||||
|
|
||||
LL | let x = (x[0], x[1]);
|
||||
| ^^^^^^^^^^^^
|
||||
@ -72,7 +72,7 @@ LL | let x = (x[0], x[1]);
|
||||
= help: use `.into()` instead, or `<(T0, T1, ..., Tn)>::from` if type annotations are needed
|
||||
|
||||
error: it looks like you're trying to convert a tuple to an array
|
||||
--> $DIR/tuple_array_conversions.rs:100:13
|
||||
--> $DIR/tuple_array_conversions.rs:105:13
|
||||
|
|
||||
LL | let x = [x.0, x.1];
|
||||
| ^^^^^^^^^^
|
||||
|
Loading…
Reference in New Issue
Block a user