I think it's supposed to just be uncreachable! with panic swapped out for abort
I think it's supposed to just be uncreachable! with panic swapped out for abort
All unreachable does is call panic, so that would just be abort
I suppose we're waiting on `core::hint::cold_path` to be stable? Then it'd be pretty easy to stick in the macro, imv :D doc.rust-lang.org/core/hint/in...
The standard library uses so much unstable code anyway it’d be strange for that to be blocker 😄
plus the formatted print beforehand
huh I don't know why I thought it made a compiler hint, I guess the argument for it is the same as the argument for having unreachable! itself (in that you provide a different name with different semantic implications although the different message part is irrelevant
I mean, nothing stops us from making `unreachble!` also expand to `hint::cold_path()`...
arguably, panic! could also expand to that couldn't it?
wait. this would be kinda perfect
in what way?
Panics are "unexpected" and, when they occur, we're going to unwind and be slow anyway! In most cases, I think marking it as the "cold path" would be a good default
yea..
yeah, I thought about it after posting my skeet, ur right ^^'
maybe? I know some people reuse its unwinding mechanism for more general exceptions, but they could very well be using a lower level mechanism than panic! (and I don't know if there's any stability guarantees that prevent that)
yeah, it's strange (and I guess somewhat unintuitive) that it doesn't. The reason appears to be that it was introduced in 2011 and the only change since was just updating for different panic editions github.com/rust-lang/ru...
I wouldn't say it's that strange. `cold_path` is a somewhat new addition and it's not totally clear if it does anything in practice... also, you will be surprised how many things aren't done simply because no one thought about them at all, or didn't care enough to do ^^'
ah that makes sense Yeah I'm not surprised, I think it's kind of inevitable
Yeah, I’m kinda not a fan of unreachable for this exact reason