-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Remove duplicate error about raw underscore lifetime #143280
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
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: xizheyin <[email protected]>
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.
Can you instead use tcx.sess.psess.raw_identifier_spans
to look for the raw lifetime span? I think we populate raw_identifier_spans
with raw lifetimes too.
If not, then I don't think this hack should land. Using span_to_snippet
here seems fragile.
r? compiler-errors |
I have a try on it, and it works. |
Signed-off-by: xizheyin <[email protected]>
// To avoid emitting two duplicate errors, we need to check if the span is a raw underscore lifetime, see issue #143152 | ||
let is_raw_underscore = self | ||
.r | ||
.tcx | ||
.sess | ||
.psess | ||
.raw_identifier_spans | ||
.iter() | ||
.any(|span| span == param.span()); | ||
if param.ident.name == kw::UnderscoreLifetime && !is_raw_underscore { |
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'm wondering if I should split it into 2 parts, as this doesn't seem very aesthetically pleasing taking up so many lines. However it seems to give the wrong impression that the variable in the middle will be used multiple times.
Fixes #143152
r? @fee1-dead