Avoid panic branch in EscapeDefault::backslash and EscapeDebug::backslash.#121805
Avoid panic branch in EscapeDefault::backslash and EscapeDebug::backslash.#121805reitermarkus wants to merge 1 commit intorust-lang:masterfrom
EscapeDefault::backslash and EscapeDebug::backslash.#121805Conversation
|
r? |
|
Are you sure that that's where the panic comes from? As far as I can tell, LLVM is able to optimize this out. |
|
I assume the |
|
This is the wrong panic, the See how the BB in bjorn's Godbolt example is only reached from two comparisons that depend on the result of It will never trigger but cannot be optimized out since rust/library/core/src/char/mod.rs Line 342 in 9db7a74 I'll close this PR, but feel free to |
…t-inline, r=joboet Optimize character escaping. Allow optimization of panicking branch in `EscapeDebug`, see rust-lang#121805. r? `@joboet`
Rollup merge of rust-lang#124307 - reitermarkus:escape-debug-size-hint-inline, r=joboet Optimize character escaping. Allow optimization of panicking branch in `EscapeDebug`, see rust-lang#121805. r? `@joboet`
See japaric/ufmt#52 and https://github.com/andrewgazelka/ufmt/blob/e97ce1a86cfcc9fa36ffab6ee62762c00e4b3fc9/src/impls/core.rs#L62.
This avoids the unreachable panicking branch in
char::escape_debug.Not sure what the best way to test this is.