Update debuginfo for change in 1.71 #241
Merged
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.
There was an unanticipated change in 1.71 that added stringly-typed debuginfo in the profile struct. After discussing with the cargo team, we have decided to keep this change even though it has caused breakage. Fortunately this only affects projects which have opted-in to the string-based variants.
There isn't a clear alternative for how to represent this information (they can't be accurately mapped to numbers), and we don't have a way to version this JSON output (which would also be a breaking change if we changed the version). We currently don't have a good story for how to manage JSON compatibility of the compiler messages, which is something we should probably figure out at some time.
I decided to go ahead and map the values to their semantic meaning, with an escape hatch for unknown values that might be added in the future. Alternatively it could just be a two-variant enum (int/string), but adding the mapping wasn't too difficult. However, this means that the round-trip serialization isn't exact (null or missing gets mapped to 0). I don't expect that to be an issue, but I'm not sure why anyone would serialize these.
Fixes #240