I saw a bug with optimization for unimplemented! macro 
I have a piece of code which never reach an arm with unimplemented! call, and it’s absolutely true for debug build, but…
when I try to build the release it reaches (!) unreachable arm and do unimplemented! panic.
I believe there is no bug in my code, because if I change unreachable arm to return expression bug disappears. Release build works well and the second arm never reached again.
match model.find_resource(entry.key()) {
Some(res) => {
let record = ResourceRecord::new(
res.initial_value,
res.lower_limit,
res.upper_limit);
entry.insert(record)
},
None => {
// unimplemented!()
return Err(E::from(Error::ResourceNotFound(format!("resource '{}' lost", entry.key()))));
},
}
I didn’t create an issue, because I haven’t an good example to reproduce it.
The real code where I saw it is large and proprietary. But I believe there is inconstant optimizer’s behavior.
Did anyone see something similar?
I use:
nightly-x86_64-pc-windows-gnu (default)
rustc 1.16.0-nightly (9761b17d5 2017-01-21)