Repository navigation
Create a size-limited fmt::Formatter outside of v0 for full limiting. - #50
Merged
Merged
Conversation
Member
|
Seems reasonable to me! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previously, we were using the single
fmt::Formattercreated by the user, all the way deep intov0- this is largely incorrect, as any formatting features (e.g. width padding) would be applied to all of the relevant leaves.Also, because we didn't want to create a
fmt::Formatterfor every formatting operation, the size limiting was approximate, since onlywrite_strcalls would be affected by it.This PR solves both of those issues by moving the size-limited
fmt::Writesink out ofv0, and uses it to create onefmt::Formatterthat the wholev0(orlegacy) demangling output is passed through, with no way for the demangling logic to (accidentally) bypass the size-limiting at all.The second commit is mostly stylistic, trying to enforce a pattern of "not using
write!in demangling logic", and only usingfmt::Trait::fmt(&value, self.out)- which I'm guessing we do want (for performance reasons?).