Use quote_spanned when generating calls to gc_arena methods#12
Merged
kyren merged 1 commit intokyren:masterfrom Feb 13, 2021
Merged
Use quote_spanned when generating calls to gc_arena methods#12kyren merged 1 commit intokyren:masterfrom
quote_spanned when generating calls to gc_arena methods#12kyren merged 1 commit intokyren:masterfrom
Conversation
We now span calls to `Collect::needs_trace` and `Collect::trace` with the span of the field that we're generating the call for. This leads to nicer error messages when a trait bound is not fulfulled (and likely better runtime backtraces as well)
Aaron1011
commented
Feb 12, 2021
| ::: $WORKSPACE/src/gc-arena/src/collect.rs | ||
| | | ||
| | Self: Sized, | ||
| | ----- required by this bound in `needs_trace` |
Collaborator
Author
There was a problem hiding this comment.
This is due to rust-lang/rust#82038 - once that issue is fixed, this extra line should go away.
Collaborator
Author
|
The CircleCI tests failed, but I'm getting a 404 page when I click on 'Details' |
Owner
CircleCI is failing due to a rustfmt error: But I'm not too concerned about it, I can make a rustfmt pass in a bit before doing another release. Otherwise this makes sense and LGTM. Also CircleCI has been erroring for me recently at git checkout for some reason, I have no idea why yet and I haven't fixed it. |
Aaron1011
added a commit
to Aaron1011/gc-arena
that referenced
this pull request
Feb 13, 2021
PR kyren#12 used `quote_spanned` to make error messages have the span of the corresponding field in the struct. However, there's no indication that the error comes from `#[derive(Collect)]`, which could be confusing for people unfamiliar with the crate. This PR uses `Span::resolved_at` to give the generated spans the hygiene information from the call site. This causes rustc to add a note about the error message originating from a macro, while still keeping the error message at the proper location.
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.
We now span calls to
Collect::needs_traceandCollect::tracewith the span of the field that we're generating the call for. This
leads to nicer error messages when a trait bound is not fulfulled (and
likely better runtime backtraces as well)