Optimize core::unicode::printable. by reitermarkus · Pull Request #139540 · rust-lang/rust (original) (raw)

This appears to be an optimization. It doesn't seem to be doing anything super Unicodey; it appears to be doing some byte lookup optimizations. I don't think I have the bandwidth to review this right now.

I'm wary about the unsafe here. If this is going to have unsafe, it should be thoroughly documented. At the moment there's no clarity on what these functions or these constants actually are, which isn't great but it's "not great" in an okay way because there's no unsafe.

I'd also suggest rewriting it so that the actual Rust code does not need to be autogenerated, just some constants and a small match for the large parts.