It's not about me parsing or creating a str. It's about the 100 dependencies every rust project has which might hand me a str that wasn't parsed safely.
I can avoid UB in my own C++ code too, the fact that the language has UB is a reason I even look at other options from time to time. To find UB in such a fundamental part of safe Rust was truly a surpise to me.
It feels like they could have very easily just made it a byte slice and said it's up yo you to validate, instead they decided it has to be valid UTF-8 or it's UB.
I can avoid UB in my own C++ code too, the fact that the language has UB is a reason I even look at other options from time to time. To find UB in such a fundamental part of safe Rust was truly a surpise to me.
It feels like they could have very easily just made it a byte slice and said it's up yo you to validate, instead they decided it has to be valid UTF-8 or it's UB.