Skip to content

write! macro: remove runtime check#310

Merged
bors[bot] merged 1 commit intomainfrom
write-rm-runtime-check
Dec 16, 2020
Merged

write! macro: remove runtime check#310
bors[bot] merged 1 commit intomainfrom
write-rm-runtime-check

Conversation

@japaric
Copy link
Copy Markdown
Member

@japaric japaric commented Dec 16, 2020

when this feature was added, it was possible to call write! more than once from a Format::format
implementation. that operation corrupted the data stream so a runtime check was added to write! to
prevent the data corruption by panicking on a double use of write!

PR #305 makes write! consume the Formatter value so the above issue is now prevented at compile
time. The runtime check is no longer necessary (failure case is unreachable) so we remove it

when this feature was added, it was possible to call `write!` more than once from a `Format::format`
implementation. that operation corrupted the data stream so a runtime check was added to `write!` to
prevent the data corruption by panicking on a double use of `write!`

PR #305 makes `write!` consume the `Formatter` value so the above issue is now prevented at compile
time. The runtime check is no longer necessary (failure case is unreachable) so we remove it
@jonas-schievink
Copy link
Copy Markdown
Contributor

bors r+

@bors
Copy link
Copy Markdown
Contributor

bors Bot commented Dec 16, 2020

Build succeeded:

@bors bors Bot merged commit 98cd3ea into main Dec 16, 2020
@bors bors Bot deleted the write-rm-runtime-check branch December 16, 2020 16:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants