Using const generics

Status: Stub

Complete const generics are currently unstable. You can track their progress here.

Const generics are ok to use in public APIs, so long as they fit in the min_const_generics subset.

For reviewers

Look out for const operations on const generics in public APIs like:


#![allow(unused)]
fn main() {
pub fn extend_array<T, const N: usize, const M: usize>(arr: [T; N]) -> [T; N + 1] {
    ..
}
}

or for const generics that aren't integers, bools, or chars:


#![allow(unused)]
fn main() {
pub fn tag<const S: &'static str>() {
    ..
}
}