[go: up one dir, main page]

|
|
Log in / Subscribe / Register

To all the "why bother" rustaceans

To all the "why bother" rustaceans

Posted Dec 9, 2022 9:29 UTC (Fri) by tialaramex (subscriber, #21167)
In reply to: To all the "why bother" rustaceans by mathstuf
Parent article: Rust support coming to GCC

In fact the whole reason Polonius (the newer checker GCC would like to adopt) is under development is that Rust's borrow checkers are checking a semantic constraint, which means Rice's theorem applies, the actual question we have (does this program obey the borrowing rules) is Undecidable.

Rust chooses to answer conservatively, Don't Know counts as No. All three borrow checkers, the one in Rust 1.0, the current one with Non-lexical lifetimes, and Polonius, are conservative, but each increases the range of correct Rust programs which successfully compile over the last.

The conservative choice offers safety, which is Rust's priority, at a cost of programmer inconvenience, which can be iteratively improved upon by working on the borrow checker. Thus, I believe Rust can and should specify that the actual rules are (basically) as you describe, but with a clarifying note that since these are semantic rules any compiler must be conservative. Maybe the note can specify that a conforming compiler must at least be able to allow X where X is some sane baseline of borrow simplicity.


to post comments

To all the "why bother" rustaceans

Posted Dec 9, 2022 13:11 UTC (Fri) by amacater (subscriber, #790) [Link] (1 responses)

Unforeseen problems with Polonius presumably would be the sorts of subtle errors you don't notice until they creep up and stab you in the arras ...

To all the "why bother" rustaceans

Posted Dec 9, 2022 15:26 UTC (Fri) by tialaramex (subscriber, #21167) [Link]

Hamlet was never a play I studied, and it's a bit long for me, so I had to actually look up the reference.

Rust's stability promise has a number of limitations, the one crucial here is that you don't get to depend on bugs. So if the borrow checker, no matter which one, was mistakenly allowing an invalid construction, Rust won't keep that working in future versions.


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds