#![allow(incomplete_features)] #![feature(generic_const_exprs)] extern crate const_guards; use const_guards::guard; fn main() { let array: &[(); 1] = &[(); 1]; let _: &() = array.head(); } trait ArrayHead { #[guard( { N > 0 })] fn head(&self) -> &T; } impl ArrayHead for [T; N] { fn head(&self) -> &T { &self[0] } }