perform span attributions in serde *Access impls - #229
Open
sunshowers wants to merge 1 commit into
Conversation
This lets us always provide _some_ kind of span in diagnostics. We rely on the property that in the middle of deserializing a value, serde hands control back to us only through the `Access` traits. This means that as long as we cover the methods: * `next_key_seed` (covered by `next_value_seed`) * `next_value_seed` * `next_element_seed` * `variant_seed` * `newtype_variant_seed` * `tuple_variant` * `struct_variant` as well as the top level, we can always convert a `NoData` error into the corresponding `Normal` error with the tightest available span. This fixes a number of panics and incorrect spans, as shown by the UI tests.
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.
This lets us always provide some kind of span in diagnostics.
We rely on the property that in the middle of deserializing a value, serde's upcalls back to us always go through the
Accesstraits. This means that as long as we cover the methods:next_key_seed(covered bynext_value_seed)next_value_seednext_element_seedvariant_seednewtype_variant_seedtuple_variantstruct_variantas well as the top level, we can always convert a
Unspannederror into the correspondingSpannederror with the tightest available span.This fixes a number of panics and incorrect spans, as shown by the UI tests.