2 ms·
If you were to define a subset of Rust's standard library (core + alloc + std) that does not contain the `panic!` macro, and excluded all functionality that nee
by jmillikin 4y ago
If you were to define a subset of Rust's standard library (core + alloc + std) that does not contain the `panic!` macro, and excluded all functionality that needed to panic, then safe Rust could be proven to never panic (because it can't).
That's different than solving the halting problem. You're not trying to prove it halts, you're just trying to prove it doesn't halt in a specific way, which is trivial to prove if you first make it impossible.
- gpm 4y ago> If you were to define a subset of Rust's standard library (core + alloc + std) that does not contain the `panic!` macro, and excluded all functionality that needed to panic, then safe Rust could be proven to never panic (because it can't). Not quite, because stack overflows can cause panics independent of any actual invocation of the panic macro. You need to either change how stack overflows are handled as well, or you need to do some static analysis of the stack size as well. Both are possible (while keeping rust turing complete), so it's still not like the halting problem.
- jmillikin 4y agoIn a Rust defined without `panic!`, a stack overflow would not be able to panic. What would probably happen is the process would just die, like C.