-
Notifications
You must be signed in to change notification settings - Fork 308
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Panic when calling .format
: "Format: was already formatted once"
#694
Comments
Trying this with different compiler versions, it seems like this is a regression in EDIT: rust-lang/rust#110717 |
Seems to be the same as #667. |
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this issue
Apr 24, 2023
format panic message only once For `panic!` and friends, the `std` panic runtime will always set the `.payload()` of `PanicInfo` to the formatted string. The linked issues show that formatting the message twice can cause problems, so we simply print the already formatted message instead of formatting it again. We can't remove the preformatted payload, because it can be observed by custom panic hooks. fixes rust-lang#110717 fixes rust-itertools/itertools#694 cc `@Amanieu` who broke this in rust-lang#109507
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this issue
Apr 24, 2023
format panic message only once For `panic!` and friends, the `std` panic runtime will always set the `.payload()` of `PanicInfo` to the formatted string. The linked issues show that formatting the message twice can cause problems, so we simply print the already formatted message instead of formatting it again. We can't remove the preformatted payload, because it can be observed by custom panic hooks. fixes rust-lang#110717 fixes rust-itertools/itertools#694 cc ``@Amanieu`` who broke this in rust-lang#109507
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this issue
Apr 24, 2023
format panic message only once For `panic!` and friends, the `std` panic runtime will always set the `.payload()` of `PanicInfo` to the formatted string. The linked issues show that formatting the message twice can cause problems, so we simply print the already formatted message instead of formatting it again. We can't remove the preformatted payload, because it can be observed by custom panic hooks. fixes rust-lang#110717 fixes rust-itertools/itertools#694 cc ```@Amanieu``` who broke this in rust-lang#109507
JohnTitor
added a commit
to JohnTitor/rust
that referenced
this issue
Apr 28, 2023
format panic message only once Formatting the panic message multiple times can cause problems for some real-world crates, so here's a test to ensure that we don't do that. This was regressed in rust-lang#109507 and reverted in rust-lang#110782. fixes rust-lang#110717 fixes rust-itertools/itertools#694
With rust-lang/rust#110721 merged, this will work in the next nightly Rust version again. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I tried this code:
Playground
And when trying to run it, I got this panic:
Format: was already formatted once
My workaround is to use
join
instead.The text was updated successfully, but these errors were encountered: