Resolving Rust's forward progress guarantees

Anyone at all can insert their own side effect into their code using Stable Rust:

let x = 0; unsafe { core::ptr::read_volatile(&x) };

So, as an immediate measure that could also be rolled back later once a full fix is applied, we can probably start by warning on loop{} and telling people to add that code into their loop body.

1 Like

If you're going to go through the trouble of detecting loop{} and warning on it (and then expecting the user to insert their own unsafe volatile read), I think it's far better to just have rustc insert sideeffect for loop{}.

I'm personally in favor of the prior suggestion of inserting sideeffect for trivial, easily detectable infinite loops and ignoring nontrivial infinite loops. That strikes a good balance between various trade offs.

7 Likes