News for hackers. Stuff that matters.
Re:Beyond the & by ivanbakel on Thursday October 22, 2026 @06:01AM (#50193353)
It's missing the point of these changes to suggest that the current version is good because the error has a just-so explanation. The same code without the MutexGuard is conceptually the same, and there a mutable reference is dereferenced twice without an error. Should the programmer need to know that they themselves need to manually write the mutable-reference coercion that the compiler would normally do to unlock the same expressivity? Is this good and intuitive language design?

>Is there an example that really benefits from these features?

That question would be easier to answer if you would spell out what you don't find compelling about the article's example, beyond the fact that you can identify a reason for the error to occur.

Re:Beyond the & by creata on Thursday October 22, 2026 @09:15AM (#50194882)
> what you don't find compelling about the article's example, beyond the fact that you can identify a reason for the error to occur.

It's not just that there's a reason for the error to occur, it's that (1) the line between what the borrow checker can and can't do is currently clear, even if it's privileging references and boxes, and (2) the fix is a one-line change. Exposing more language hook points via traits to save one line here and there is what doesn't seem compelling to me, which is why I asked for an example where it leads to a more significant improvement in the code.

Like, the mentioned roadmap page says "But Option<&mut T> or custom smart pointers require awkward .as_deref_mut() or .reborrow() calls"; what I'm asking is: how awkward?