Skip to content
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

write! macro: remove runtime check #310

Merged
merged 1 commit into from
Dec 16, 2020
Merged

write! macro: remove runtime check #310

merged 1 commit into from
Dec 16, 2020

Conversation

japaric
Copy link
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
Contributor

bors r+

@bors
Copy link
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