The constructor of NonZeroU8 is a const fn, but it returns an Option, and Option.unwrap() is not a const fn, so the following won't compile:
use std::num::NonZeroU8;
const _: NonZeroU8 = NonZeroU8::new(7).unwrap();
The best work-around I've found is:
use std::num::NonZeroU8;
const _: NonZeroU8 = unsafe {NonZeroU8::new_unchecked(7)};
The use of "unsafe" is unsatisfying. Is there a safe way?