-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Remove dead or useless code from Session #83596
Conversation
This comment has been minimized.
This comment has been minimized.
c4e33e2
to
f9b26a6
Compare
fn deref(&self) -> &Self::Target { | ||
self.diagnostic() | ||
} | ||
} |
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 not very clean IMO and prevents deref to any other type in the future.
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.
Yea... this always was the "obvious" way to eliminate the duplication and we didn't do it on purpose.
we could add a diag()
method on TyCtxt
and Session
and "just" use it everywhere. This would change all tcx.sess.span...
to tcx.diag().span...
, so it isn't really more verbose.
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.
Hmm, I wonder if that should go through MCP - it would be a lot of work and I'd hate to throw it away because someone didn't like the new API.
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.
Yea, do an MCP or bring it up with @estebank directly before opening an MCP
This comment has been minimized.
This comment has been minimized.
f9b26a6
to
0510ca7
Compare
This comment has been minimized.
This comment has been minimized.
The name was misleading, it wasn't actually a fatal error.
All of them immediately called `emit()` then `raise()`, so they could just call `span_fatal` directly.
It had no callers which didn't immediately call `raise()`, and this unifies the behavior with `Session`.
I don't have time to follow up with this - I think the other commits are good, I've dropped 245811f. If there are review comments I will likely not have time to address them unfortunately, at least for the next month or so. |
@bors r+ |
📌 Commit f25aa57 has been approved by |
☀️ Test successful - checks-actions |
This is a more principled follow-up to #83185 (comment).
Parser::span_fatal_err
->Parser::span_err
struct_span_fatal
Diagnostic::span_fatal
unconditionally raise an errorimpl Deref<Target = Handler>
for Session and remove all functions that are exactly the same as their Handler counterpartsHandler::fatal
is different fromSesssion::fatal
opt_span_warn
functionr? @oli-obk or @estebank