-
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
Tighten span when suggesting lifetime on path #92333
Conversation
This comment has been minimized.
This comment has been minimized.
d102081
to
50ac7e9
Compare
// HACK: we use find_ancestor_inside to associate to properly suggest elided spans | ||
// in paths originating from macros. |
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.
nit: grammar
also, what do macros have to do with this?
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.
so macros have nothing to #92324. But src/test/ui/in-band-lifetimes/elided-lifetimes.rs
regresses if we don't return a subspan of the path_span
.
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.
That's presumably why segment.ident.span
was changed to path_span
in #90446, but we still need a span that points to just the segment, not the whole path.
So this finds the segment's span inside of any macro if path_span
inside of one.
50ac7e9
to
e37d012
Compare
Thanks @compiler-errors! |
📌 Commit e37d012 has been approved by |
…askrgr Rollup of 7 pull requests Successful merges: - rust-lang#92076 (Ignore other `PredicateKind`s in rustdoc auto trait finder) - rust-lang#92219 (Remove VCVARS_BAT) - rust-lang#92238 (Add a test suite for stringify macro) - rust-lang#92330 (Add myself to .mailmap) - rust-lang#92333 (Tighten span when suggesting lifetime on path) - rust-lang#92335 (Document units for `std::column`) - rust-lang#92344 (:arrow_up: rust-analyzer) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
This is kind of a hack.
Really the issue here is that we want to suggest the segment's span if the path resolves to something defined outside of the macro, and the macro's span if it resolves to something defined within.. I'll look into seeing if we can do something like that.
Fixes #92324
r? @cjgillot