You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
const-checking accepts some code that executes non-const drops #164194
use std::num::NonZero;#[repr(transparent)]structNotConstDestruct(NonZero<u8>);implDropforNotConstDestruct{fndrop(&mutself){eprintln!("this is not const");}}enumMyOpt{None(()),Some(NotConstDestruct),}const _:() = {assert!(std::mem::size_of::<MyOpt>() == 1);letmut x = MyOpt::None(());let ptr = match x {MyOpt::None(refmut field) => field as*mut(),
_ => unreachable!(),};unsafe{ ptr.cast::<u8>().write(1)};};
See here for why this happens. There is no fix yet.
Activity
theemathas commentedon Oct 12, 2026
Another way to ICE (variant of "example 2"):
theemathas commentedon Oct 12, 2026
Another variant:
theemathas commentedon Oct 12, 2026
Another variant:
theemathas commentedon Oct 12, 2026
Another way to ICE: