Loading RustViz Engine...
Showcase code that failed in Rust 2015 lexical scopes but compiles cleanly under 2018/2021 NLL.
This problem is currently in blueprint template mode. Once the concept foundation is finalized, live in-browser WebAssembly compilation and test assertion runners will be enabled here.
pub fn nll_example(map: &mut std::collections::HashMap<String, i32>, key: &str) {
if let Some(val) = map.get_mut(key) {
*val += 1;
return; // &mut borrow ends here at return CFG edge!
}
map.insert(key.to_string(), 1); // Cleanly allowed under NLL
}