Introduce sys_common::rt::rtprintpanic! to replace sys_common::util functionality#84697
Introduce sys_common::rt::rtprintpanic! to replace sys_common::util functionality#84697bors merged 5 commits intorust-lang:masterfrom
sys_common::rt::rtprintpanic! to replace sys_common::util functionality#84697Conversation
|
r? @m-ou-se (rust-highfive has picked a reviewer for you, use r? to override) |
library/std/src/sys_common/rt.rs
Outdated
There was a problem hiding this comment.
The name could be something different, rtwrite, rtprint, rtoutput etc.
There was a problem hiding this comment.
Maybe something with print in the name would be better. err might suggest it returns from the function or panics or aborts.
There was a problem hiding this comment.
rtprintpanic!? I think I'll also add a comment about that this writes to the designated "panic output", which is just stderr on most platforms.
library/std/src/panicking.rs
Outdated
There was a problem hiding this comment.
Is there a particular reason why here in panicking intrinsics::abort is used instead of sys::abort_internal? Otherwise this could also be written with rtabort!.
There was a problem hiding this comment.
sys::abort_internal calls libc::abort() (at least on unix). intrinsics::abort does not rely on libc or the platform, but simply results in executing an invalid instruction. I don't know if there's a reason to avoid libc::abort() here. It'd require some digging through the git history to see if this was changed on purpose, or added before the alternative existed, or something like that. :(
There was a problem hiding this comment.
I looked through the history, these intrinsics::abort were indeed added before sys::abort_internal existed. As far as I can tell these could be replaced, along with a safety comment added to abort_internal that it's implementation is not allowed to panic (else panicking is stuck in a loop). However there are more occurrences of intrinsics::abort in std that in my opinion could also be replaced, so I think I'm leaving it like this for now and will address those together in a future PR.
sys_common::rt::rterr to replace sys_common::util functionalitysys_common::rt::rterr! to replace sys_common::util functionality
|
Ready for another look, only changed the name from |
sys_common::rt::rterr! to replace sys_common::util functionalitysys_common::rt::rtprintpanic! to replace sys_common::util functionality
|
☔ The latest upstream changes (presumably #81858) made this pull request unmergeable. Please resolve the merge conflicts. |
|
I have some Opinions about |
|
See #85377. |
|
@CDirkx Thanks again! This looks good to me. Can you rebase it to include the new abort message in |
|
Rebased 👍🏻 |
|
Thanks! @bors r+ |
|
📌 Commit 4ff5ab5 has been approved by |
Introduce `sys_common::rt::rtprintpanic!` to replace `sys_common::util` functionality This PR introduces a new macro `rtprintpanic!`, similar to `sys_common::util::dumb_print` and uses that macro to replace all `sys_common::util` functionality.
|
☀️ Test successful - checks-actions |
This PR introduces a new macro
rtprintpanic!, similar tosys_common::util::dumb_printand uses that macro to replace allsys_common::utilfunctionality.