Medium
A const generic parameter used in an arithmetic array length
What happens when this program is compiled with a stable toolchain?
main.rs
fn append_zero<const N: usize>(a: [u8; N]) -> [u8; N + 1] {
let mut out = [0u8; N + 1];
out[..N].copy_from_slice(&a);
out
}
fn main() {
let b = append_zero([1, 2, 3]);
println!("{:?}", b);
}47 of 53 in Rust