Re:Compiling Rust is NP-hard
by NieDzejkob on Thursday July 08, 2021 @06:40AM
(#27770287)
It still needs to ensure that one of the arms will always match. (just not executing any branch in that case is tricky, because the arms can return values)
[ Parent
| on HN ]
It does not need to check, if it assumes it. mrustc works that way, it is not trying to check code, only compile valid code: https://github.com/thepowersgang/mrustc
This is similar to C/C++'s " undefined behaviors". There are things you can write that aren't valid for the language, but that compilers are not required to catch.