-
Notifications
You must be signed in to change notification settings - Fork 69
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
Consistent Handler
naming
#699
Comments
This issue is not meant to be used for technical discussion. There is a Zulip stream for that. Use this issue to leave procedural comments, such as volunteering to review, indicating that you second the proposal (or third, etc), or raising a concern that you would like to be addressed. cc @rust-lang/compiler @rust-lang/compiler-contributors |
@rustbot second |
Ten days have passed without objection. I have made the changes in rust-lang/rust#119063. |
Consistent `Handler` naming This PR implements the renaming described in rust-lang/compiler-team#699. r? `@compiler-errors`
rust-lang/rust#119063 has merged. |
@rustbot label -final-comment-period +major-change-accepted |
Consistent `Handler` naming This PR implements the renaming described in rust-lang/compiler-team#699. r? `@compiler-errors`
Proposal
rustc diagnostics are issued through the
Handler
type. There are some problems.Handler
isn't a good name. It's not descriptive, it could be used for almost anything.Handler
have many different names:span_diagnostic
,diagnostic
,sd
,diag_handler
,err_handler
, and occasionally,handler
. These names occur a lot. I suspect the heavy use ofdiagnostic
/diag
is for historical reasons, and made more sense in the past. But today,diag
/diagnostic
is heavily used forDiagnostic
s andDiagnosticBuilder
s, so is a poor choice forHandler
things.EarlyErrorHandler
is a more descriptive name thanHandler
, but is quite long. Plus "Diagnostic" would be better than "Error", given that it issues non-error diagnostics such as warnings.handler
is used for values of typeEarlyErrorHandler
, but that potentially overlaps with values of typeHandler
, and there are some functions with both aHandler
and anEarlyErrorHandler
in scope.After some discussion on Zulip, the proposal is to rename the following types:
Handler
→DiagCtxt
HandlerInner
→DiagCtxtInner
EarlyErrorHandler
→EarlyDiagCtxt
HandlerFlags
→DiagCtxtFlags
And the following non-types:
ParseSess
:span_diagnostic
→dcx
Session
:diagnostic()
→dcx()
Parser
:diagnostic()
→dcx()
ParseSess
:with_span_handler()
→with_dcx()
AstValidator
:err_handler()
→dcx()
ShowSpanVisitor
:span_diagnostic
→dcx
CodegenContext
:create_diag_handler()
→create_dcx()
UnstableOptions
:diagnostic_handler_flags()
→dcx_flags()
SilentEmitter::fatal_handler
→fatal_dcx
new_handler()
→new_dcx()
default_handler()
->default_dcx
(){diag,diagnostic,span_diagnostic,sd,diag_handler,handler}
→dcx
(forHandler
values)handler
→early_dcx
(forEarlyErrorHandler
values)'__diagnostic_handler_sess
→'sess
(This is an exhaustive list, or very close to one.)
DiagCtxt
/dcx
are more descriptive names thanHandler
/handler
, and mirror names likeTyCtxt
/tcx
. They are also short, which is good for these names which are used a lot.Alternatives
DiagCx
/EarlyDiagCx
are also possible for the type names, and would match types likeFunctionCx
,CodegenCx
.Mentors or Reviewers
I can do the work; as mentioned above, I already have a draft implementation.
@compiler-errors or @estebank might be suitable reviewers.
Process
The main points of the Major Change Process are as follows:
@rustbot second
.-C flag
, then full team check-off is required.@rfcbot fcp merge
on either the MCP or the PR.You can read more about Major Change Proposals on forge.
Comments
This issue is not meant to be used for technical discussion. There is a Zulip stream for that. Use this issue to leave procedural comments, such as volunteering to review, indicating that you second the proposal (or third, etc), or raising a concern that you would like to be addressed.
The text was updated successfully, but these errors were encountered: