-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Implement proposed API for proc_macro_span
#111571
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is something that needs addressing. I presume it has something to do with the ordering of spans, but beyond that I'm not sure what.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@estebank Do you perhaps know what happened here? Both the old and the new diagnostic output seems a bit off here. Not sure what span it is trying to point at. (And also not sure why it changed in this PR.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like the underlying Span
coming out of the macro is absolutely malformed, very likely the end
comes before the start, but this is the first time I see this behavior in the test suite (things might have changed in the handling in the last six months). I'd need to dig deeper.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I beleive @dtolnay thought might be the result of error deduplication, when I asked him about it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the erroneous output is at most tangentially related to this PR, should it be merged and a separate issue created for the bug?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should it be merged and a separate issue created for the bug?
I think that's the best way forward. Can you open that issue?
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks fine to me, but I don't know what's up with tests/ui/macros/same-sequence-span.stderr
.
☔ The latest upstream changes (presumably #111710) made this pull request unmergeable. Please resolve the merge conflicts. |
Implementation looks fine to me. r=me with that issue filed and conflict resolved. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
cc @dtolnay — looks like merging |
💔 Test failed - checks-actions |
Implement proposed API for `proc_macro_span` As proposed in [rust-lang#54725 (comment)](rust-lang#54725 (comment)). I have omitted the byte-level API as it's already available as [`Span::byte_range`](https://doc.rust-lang.org/nightly/proc_macro/struct.Span.html#method.byte_range). `@rustbot` label +A-proc-macros r? `@m-ou-se`
Not sure what to make of that error. |
@bors retry |
Rollup of 6 pull requests Successful merges: - rust-lang#111571 (Implement proposed API for `proc_macro_span`) - rust-lang#112236 (Simplify computation of killed borrows) - rust-lang#112867 (More `ImplSource` nits) - rust-lang#113019 (add note for non-exhaustive matches with guards) - rust-lang#113094 (Fix invalid HTML DIV tag used in HEAD) - rust-lang#113111 (add myself to review for t-types stuff) r? `@ghost` `@rustbot` modify labels: rollup
Should fix CI fail after rust-lang/rust#111571
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [proc-macro2](https://togithub.com/dtolnay/proc-macro2) | workspace.dependencies | patch | `1.0.51` -> `1.0.67` | --- ### Release Notes <details> <summary>dtolnay/proc-macro2 (proc-macro2)</summary> ### [`v1.0.67`](https://togithub.com/dtolnay/proc-macro2/releases/tag/1.0.67) [Compare Source](https://togithub.com/dtolnay/proc-macro2/compare/1.0.66...1.0.67) - Special handling for the `(/*ERROR*/)` placeholder that rustc uses for macros that fail to expand ([#​405](https://togithub.com/dtolnay/proc-macro2/issues/405)) ### [`v1.0.66`](https://togithub.com/dtolnay/proc-macro2/releases/tag/1.0.66) [Compare Source](https://togithub.com/dtolnay/proc-macro2/compare/1.0.65...1.0.66) - Raise required compiler from Rust 1.31 to 1.56 ### [`v1.0.65`](https://togithub.com/dtolnay/proc-macro2/releases/tag/1.0.65) [Compare Source](https://togithub.com/dtolnay/proc-macro2/compare/1.0.64...1.0.65) - Documentation improvements ### [`v1.0.64`](https://togithub.com/dtolnay/proc-macro2/releases/tag/1.0.64) [Compare Source](https://togithub.com/dtolnay/proc-macro2/compare/1.0.63...1.0.64) - Fix parsing of bare `\r` in between tokens ([#​399](https://togithub.com/dtolnay/proc-macro2/issues/399)) ### [`v1.0.63`](https://togithub.com/dtolnay/proc-macro2/releases/tag/1.0.63) [Compare Source](https://togithub.com/dtolnay/proc-macro2/compare/1.0.62...1.0.63) - Parse `c"…"` c-string literals (tracking issue: [https://github.com/rust-lang/rust/issues/105723](https://togithub.com/rust-lang/rust/issues/105723)) ### [`v1.0.62`](https://togithub.com/dtolnay/proc-macro2/releases/tag/1.0.62) [Compare Source](https://togithub.com/dtolnay/proc-macro2/compare/1.0.61...1.0.62) *yanked* ### [`v1.0.61`](https://togithub.com/dtolnay/proc-macro2/releases/tag/1.0.61) [Compare Source](https://togithub.com/dtolnay/proc-macro2/compare/1.0.60...1.0.61) - Stricter parsing of whitespace in cooked string literals and between tokens ([#​392](https://togithub.com/dtolnay/proc-macro2/issues/392), [#​393](https://togithub.com/dtolnay/proc-macro2/issues/393)) ### [`v1.0.60`](https://togithub.com/dtolnay/proc-macro2/releases/tag/1.0.60) [Compare Source](https://togithub.com/dtolnay/proc-macro2/compare/1.0.59...1.0.60) - Eliminate uses of unstable proc_macro::Span::before/after ([#​391](https://togithub.com/dtolnay/proc-macro2/issues/391)) ### [`v1.0.59`](https://togithub.com/dtolnay/proc-macro2/releases/tag/1.0.59) [Compare Source](https://togithub.com/dtolnay/proc-macro2/compare/1.0.58...1.0.59) - Enable proc_macro support on wasm targets ([#​388](https://togithub.com/dtolnay/proc-macro2/issues/388)) ### [`v1.0.58`](https://togithub.com/dtolnay/proc-macro2/releases/tag/1.0.58) [Compare Source](https://togithub.com/dtolnay/proc-macro2/compare/1.0.57...1.0.58) - Make rustc version detection more robust by compiling against modernest stable features ([#​384](https://togithub.com/dtolnay/proc-macro2/issues/384)) ### [`v1.0.57`](https://togithub.com/dtolnay/proc-macro2/releases/tag/1.0.57) [Compare Source](https://togithub.com/dtolnay/proc-macro2/compare/1.0.56...1.0.57) - Disable nightly-only `start()`/`end()` implementation on `Span` while the upstream API is iterated on ([#​383](https://togithub.com/dtolnay/proc-macro2/issues/383), [https://github.com/rust-lang/rust/pull/111571](https://togithub.com/rust-lang/rust/pull/111571)) ### [`v1.0.56`](https://togithub.com/dtolnay/proc-macro2/releases/tag/1.0.56) [Compare Source](https://togithub.com/dtolnay/proc-macro2/compare/1.0.55...1.0.56) - Circumvent clippy::octal_escapes lint inside generated string and byte-string literals ([#​363](https://togithub.com/dtolnay/proc-macro2/issues/363), [#​380](https://togithub.com/dtolnay/proc-macro2/issues/380)) - Provide RefUnwindSafe impls for compilers older than 1.58 ([#​382](https://togithub.com/dtolnay/proc-macro2/issues/382)) ### [`v1.0.55`](https://togithub.com/dtolnay/proc-macro2/releases/tag/1.0.55) [Compare Source](https://togithub.com/dtolnay/proc-macro2/compare/1.0.54...1.0.55) - Set a meaningful `Span` for literals produced via the `FromStr` impl of `Literal` ([#​378](https://togithub.com/dtolnay/proc-macro2/issues/378)) - Implement `Literal::subspan` in non-macro contexts when "span-locations" feature is enabled ([#​379](https://togithub.com/dtolnay/proc-macro2/issues/379)) ### [`v1.0.54`](https://togithub.com/dtolnay/proc-macro2/releases/tag/1.0.54) [Compare Source](https://togithub.com/dtolnay/proc-macro2/compare/1.0.53...1.0.54) - Performance improvement to "span-locations" feature ([#​373](https://togithub.com/dtolnay/proc-macro2/issues/373)) - Fix unbounded memory usage when calling proc-macro2's parser from a fuzzer ([#​374](https://togithub.com/dtolnay/proc-macro2/issues/374)) ### [`v1.0.53`](https://togithub.com/dtolnay/proc-macro2/releases/tag/1.0.53) [Compare Source](https://togithub.com/dtolnay/proc-macro2/compare/1.0.52...1.0.53) - Add support for Rust 1.66's `source_text()` method ([#​350](https://togithub.com/dtolnay/proc-macro2/issues/350)) ### [`v1.0.52`](https://togithub.com/dtolnay/proc-macro2/releases/tag/1.0.52) [Compare Source](https://togithub.com/dtolnay/proc-macro2/compare/1.0.51...1.0.52) - Add [`Group::delim_span`](https://docs.rs/proc-macro2/1.0.52/proc_macro2/struct.Group.html#method.delim_span) ([#​366](https://togithub.com/dtolnay/proc-macro2/issues/366)) </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/sammyfilly/Nextjs).
As proposed in #54725 (comment). I have omitted the byte-level API as it's already available as
Span::byte_range
.@rustbot label +A-proc-macros
r? @m-ou-se