-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-cleanupCategory: PRs that clean code up or issues documenting cleanup.Category: PRs that clean code up or issues documenting cleanup.E-mediumCall for participation: Medium difficulty. Experience needed to fix: Intermediate.Call for participation: Medium difficulty. Experience needed to fix: Intermediate.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
In our first @rust-lang/wg-diagnostics meeting on zulip we figured that a first start would be to create a new trait
trait AsError {
/// ParseSess, Session or `TyCtxt`
type Session;
fn to_error(self, session: Self::Session) -> DiagnosticBuilder;
fn emit(self) {
self.to_error().emit()
}
}
that is implemented for structs containing all relevant info for a diagnostic, e.g.
struct TypeError {
expected: Ty,
found: Ty,
span: Span,
}
and then the code that currently constructs the diagnostic and emits it would just become
TypeError {
expected,
found,
span: Span,
}.emit();
This issue has been assigned to @jumbatm via this comment.
mark-i-m, Centril, estebank and eternaleye
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-cleanupCategory: PRs that clean code up or issues documenting cleanup.Category: PRs that clean code up or issues documenting cleanup.E-mediumCall for participation: Medium difficulty. Experience needed to fix: Intermediate.Call for participation: Medium difficulty. Experience needed to fix: Intermediate.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.