Since rust is so topical now: rust still uses system calls, for stuff like memory allocation, right? How can apps written in rust be inherently memory safe when they rely on system calls for routines written in an unsafe language?
yes, the kernel is usually written in c. however, a memory exploit in a system routine really isn't rust's fault, it's a fault of the system. but many things in computing make assumptions about the abstractions below them, and that includes rust assuming that the operating system isn't fucked up. it goes both ways, though, like c assuming that the operating system isn't fucked up too: try running a standards-compliant c program with no ub (which obviously shouldn't have ub) under a libc with a malloc that doesn't work properly, and see what happens
If I remember correctly, it wasn't even possible to detect if certain code would produce an app that would block indefinitely or not.
this is called the "halting problem" and it actually states that you are not guaranteed to be able to know if a certain turing machine ever halts, which is an important distinction
proving eventual termination is actually a pretty cool thing that languages could do, but nobody's really working on it (probably because compilers smart enough to do it are hard to write and specifications for the languages are even harder to write)
just because you can't sort things into "halts" and "does not halt", doesn't mean you can't sort things into "halts", "does not halt", and "maybe halts" which is conservatively treated as "does not halt" unless you override it (since turing-completeness is nice to have actually)
Isolating all the unsafe bits to system calls is still a major win for safety. There's also not much you can do if a syscall like memory allocation fucks up.
you can't magically ensure that e.g. your cpu's arithmetic instructions don't give the wrong answers, but you can ensure that you won't add any other broken shit on top of all the other potentially broken shit