1 // Regression test for the ICE described in #87046.
4 #![allow(unreachable_patterns)]
5 #![feature(const_fn_union)]
7 #[derive(PartialEq, Eq)]
9 pub struct Username(str);
11 pub const ROOT_USER: &Username = Username::from_str("root");
14 pub const fn from_str(raw: &str) -> &Self {
20 unsafe { Transmute { raw }.typed }
23 pub const fn as_str(&self) -> &str {
27 pub fn is_root(&self) -> bool {
30 //~^ ERROR: cannot use unsized non-slice type `Username` in constant patterns