Skip to content

Commit 846ce3c

Browse files
committed
test const-generic Vec::from(array)
1 parent 5ff7eef commit 846ce3c

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

tests/run-pass/arrays.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,17 @@ fn slice_index() -> u8 {
3535
arr[5]
3636
}
3737

38-
fn try_from() {
38+
fn from() {
3939
const N: usize = 16;
4040
type Array = [u8; N];
4141
let array: Array = [0; N];
4242
let slice: &[u8] = &array[..];
4343

4444
let result = <&Array>::try_from(slice);
4545
assert_eq!(&array, result.unwrap());
46+
47+
let vec = Vec::from(array);
48+
assert_eq!(vec.len(), N);
4649
}
4750

4851
fn eq() {
@@ -69,7 +72,7 @@ fn main() {
6972
assert_eq!(array_array(), [[5, 4], [3, 2], [1, 0]]);
7073
assert_eq!(array_repeat(), [42; 8]);
7174
assert_eq!(mini_array(), [42]);
72-
try_from();
75+
from();
7376
eq();
7477
debug();
7578
}

0 commit comments

Comments
 (0)