3 ms·
As mentioned here [1], NLL doesn't just provide ergonomic benefits, it actually fixed soundness bugs w/ the previous borrow checker. [1]: http://smallcultfollo
by almostdeadguy 8y ago
As mentioned here [1], NLL doesn't just provide ergonomic benefits, it actually fixed soundness bugs w/ the previous borrow checker.
[1]: http://smallcultfollowing.com/babysteps/blog/2018/10/31/mir-based-borrowck-is-almost-here/#diagnostics-migration-and-performance http://smallcultfollowing.com/babysteps/blog/2018/10/31/mir-...
- foldr 8y agoIs that because the lexical model was fundamentally unsound? Or just because various bugs were turned up in the course of implementing NLL?
- kibwen 8y agoIt's because the previous implementation didn't track enough information to properly cover some edge cases of the theoretical model. Extending the old implementation to track such information would have been congruent to implementing the new borrow checker, with all the additional overhead that implies (or even more, considering that the new implementation has been designed with this in mind from the ground up).
- foldr 8y agoSo this is actually a major bug fix rather than an ergonomic improvement?
- steveklabnik 8y agoIt’s both.
- foldr 8y agoOk, good to know. That's definitely not how it's presented in the blog post.
- steveklabnik 8y agoMost people care way more about the ergonomic improvement than they do the soundness fixes, because the soundness issues are very, very rare, but the ergonomic pain is very present.
- foldr 8y agoNo-one would suggest that the dev team ought to hold off on a soundness fix for performance reasons. It seems like it would be worth mentioning that aspect of NLL when raising the issue of compile times. I certainly would not have made my original comment if the blog post had made that clear.
- Twirrim 8y agoAs mentioned in the first line of the blog post (and linked) it was essentially a follow-up to another blog post, http://smallcultfollowing.com/babysteps/blog/2018/10/31/mir-based-borrowck-is-almost-here/ http://smallcultfollowing.com/babysteps/blog/2018/10/31/mir-... which describes the state of NLL, which also gives an example of bugs fixed by NLL and why it's desirable. This one was purely focussing on the performance side of things mentioned on that previous blog post.
- foldr 8y agoThat post briefly mentions bug fixes in the text, but doesn't actually give any examples.
- kibwen 8y agoHere's a runnable example of a bug that NLL fixes; remove the feature flag up top to observe the use-after-free: https://play.rust-lang.org/?gist=761478ea89b3cd1df50ee274cb7a909d&version=nightly https://play.rust-lang.org/?gist=761478ea89b3cd1df50ee274cb7...
- eximius 8y agoI believe the latter. IIRC, NLL is strictly more expressive than LL. I believe NLL can only shorten lifetimes, not extend them, by comparison.