Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion rust-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ef1ecbefb8719e408150738664d443a73f757ffd
14890954ce17c44d944eda988c5a64bb4c5ec9eb
13 changes: 13 additions & 0 deletions tests/run-pass/arrays.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use std::convert::TryFrom;

fn empty_array() -> [u16; 0] {
[]
}
Expand Down Expand Up @@ -33,6 +35,16 @@ fn slice_index() -> u8 {
arr[5]
}

fn try_from() {
const N: usize = 16;
type Array = [u8; N];
let array: Array = [0; N];
let slice: &[u8] = &array[..];

let result = <&Array>::try_from(slice);
assert_eq!(&array, result.unwrap());
}

fn eq() {
const N: usize = 16;
type Array = [u8; N];
Expand All @@ -57,6 +69,7 @@ fn main() {
assert_eq!(array_array(), [[5, 4], [3, 2], [1, 0]]);
assert_eq!(array_repeat(), [42; 8]);
assert_eq!(mini_array(), [42]);
try_from();
eq();
debug();
}