Warning
This post was published 41 days ago. The information described in this article may have changed.
In terms of lifetime analysis, Polonius is more ergonomic than NLL, but why hasn’t it been integrated into the stable or nightly channels yet?
Consider the following code:
fn get_default<'r,K,V:Default>(map: &'r mut HashMap<K,V>,
key: K)
-> &'r mut V {
match map.get_mut(&key) { // -------------+ 'r
Some(value) => value, // |
None => { // |
map.insert(key, V::default()); // |
// ^~~~~~ ERROR // |
map.get_mut(&key).unwrap() // |
} // |
} // |
} // v
I am using the latest Rust compilers:
rustc 1.85.0 (4d91de4e4 2025-02-17)
rustc 1.87.0-nightly (f4a216d28 2025-03-02)
However, the above code still fails to compile. I suspect that, so far, Rust is still using NLL instead of Polonius. Can anyone explain why Rust has not yet integrated Polonius into the stable or nightly channels? Thank you for your answers.
3 posts - 2 participants
🏷️ rust_feed