code wiki / (root) / nx_probe_match_nobind.nx

nx_probe_match_nobind.nx source

↩ module page · 13 lines · 430 B

1// nx_probe_match_nobind.nx -- bisect: does match DISPATCH on a tagged enum work 2// WITHOUT reading the payload binding v? exit 0 = dispatch ok (bug is the payload 3// read); SIGSEGV = dispatch itself crashes. expect_exit: 0 4enum Opt { None, Some(i64) } 5func main() -> i64 { 6 let o: *Opt = Opt::Some(42) 7 var r: i64 = 0 8 match o { 9 Opt::None => { r = 1 }, 10 Opt::Some(v) => { r = 2 } 11 } 12 return r - 2 13}