Skip to content

Commit 01901df

Browse files
committed
[Gardening] UPDATE - rename SessionDiagnostic to DiagnosticHandler
1 parent ee8003c commit 01901df

File tree

18 files changed

+53
-52
lines changed

18 files changed

+53
-52
lines changed

compiler/rustc_attr/src/session_diagnostics.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::num::IntErrorKind;
22

33
use rustc_ast as ast;
4-
use rustc_errors::SessionDiagnostic;
4+
use rustc_errors::DiagnosticHandler;
55
use rustc_errors::{
66
error_code, fluent, Applicability, DiagnosticBuilder, ErrorGuaranteed, Handler,
77
};
@@ -50,7 +50,7 @@ pub(crate) struct UnknownMetaItem<'a> {
5050
}
5151

5252
// Manual implementation to be able to format `expected` items correctly.
53-
impl<'a> SessionDiagnostic<'a> for UnknownMetaItem<'_> {
53+
impl<'a> DiagnosticHandler<'a> for UnknownMetaItem<'_> {
5454
fn into_diagnostic(self, handler: &'a Handler) -> DiagnosticBuilder<'a, ErrorGuaranteed> {
5555
let expected = self.expected.iter().map(|name| format!("`{}`", name)).collect::<Vec<_>>();
5656
let mut diag = handler.struct_span_err_with_code(
@@ -209,7 +209,7 @@ pub(crate) struct UnsupportedLiteral {
209209
pub start_point_span: Span,
210210
}
211211

212-
impl<'a> SessionDiagnostic<'a> for UnsupportedLiteral {
212+
impl<'a> DiagnosticHandler<'a> for UnsupportedLiteral {
213213
fn into_diagnostic(self, handler: &'a Handler) -> DiagnosticBuilder<'a, ErrorGuaranteed> {
214214
let mut diag = handler.struct_span_err_with_code(
215215
self.span,

compiler/rustc_error_messages/locales/en-US/lint.ftl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ lint_non_existant_doc_keyword = found non-existing keyword `{$keyword}` used in
5151
.help = only existing keywords are allowed in core/std
5252
5353
lint_diag_out_of_impl =
54-
diagnostics should only be created in `SessionDiagnostic`/`AddSubdiagnostic` impls
54+
diagnostics should only be created in `DiagnosticHandler`/`AddSubdiagnostic` impls
5555
5656
lint_untranslatable_diag = diagnostics should be created using translatable messages
5757

compiler/rustc_errors/src/diagnostic_builder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use std::thread::panicking;
1616
/// Trait implemented by error types. This should not be implemented manually. Instead, use
1717
/// `#[derive(SessionDiagnostic)]` -- see [rustc_macros::SessionDiagnostic].
1818
#[rustc_diagnostic_item = "SessionDiagnostic"]
19-
pub trait SessionDiagnostic<'a, T: EmissionGuarantee = ErrorGuaranteed> {
19+
pub trait DiagnosticHandler<'a, T: EmissionGuarantee = ErrorGuaranteed> {
2020
/// Write out as a diagnostic out of `Handler`.
2121
#[must_use]
2222
fn into_diagnostic(self, handler: &'a Handler) -> DiagnosticBuilder<'a, T>;

compiler/rustc_errors/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ mod snippet;
6161
mod styled_buffer;
6262
pub mod translation;
6363

64-
pub use diagnostic_builder::SessionDiagnostic;
64+
pub use diagnostic_builder::DiagnosticHandler;
6565
pub use snippet::Style;
6666

6767
pub type PResult<'a, T> = Result<T, DiagnosticBuilder<'a, ErrorGuaranteed>>;

compiler/rustc_expand/src/base.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use rustc_attr::{self as attr, Deprecation, Stability};
1111
use rustc_data_structures::fx::{FxHashSet, FxIndexMap};
1212
use rustc_data_structures::sync::{self, Lrc};
1313
use rustc_errors::{
14-
Applicability, DiagnosticBuilder, ErrorGuaranteed, MultiSpan, PResult, SessionDiagnostic,
14+
Applicability, DiagnosticBuilder, DiagnosticHandler, ErrorGuaranteed, MultiSpan, PResult,
1515
};
1616
use rustc_lint_defs::builtin::PROC_MACRO_BACK_COMPAT;
1717
use rustc_lint_defs::{BufferedEarlyLint, BuiltinLintDiagnostics};
@@ -1104,12 +1104,12 @@ impl<'a> ExtCtxt<'a> {
11041104

11051105
pub fn create_err(
11061106
&self,
1107-
err: impl SessionDiagnostic<'a>,
1107+
err: impl DiagnosticHandler<'a>,
11081108
) -> DiagnosticBuilder<'a, ErrorGuaranteed> {
11091109
self.sess.create_err(err)
11101110
}
11111111

1112-
pub fn emit_err(&self, err: impl SessionDiagnostic<'a>) -> ErrorGuaranteed {
1112+
pub fn emit_err(&self, err: impl DiagnosticHandler<'a>) -> ErrorGuaranteed {
11131113
self.sess.emit_err(err)
11141114
}
11151115

compiler/rustc_infer/src/infer/error_reporting/need_type_info.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use crate::errors::{
44
};
55
use crate::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKind};
66
use crate::infer::InferCtxt;
7-
use rustc_errors::SessionDiagnostic;
7+
use rustc_errors::DiagnosticHandler;
88
use rustc_errors::{DiagnosticBuilder, ErrorGuaranteed, IntoDiagnosticArg};
99
use rustc_hir as hir;
1010
use rustc_hir::def::Res;

compiler/rustc_lint/src/errors.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use rustc_errors::{fluent, AddSubdiagnostic, ErrorGuaranteed, Handler, SessionDiagnostic};
1+
use rustc_errors::{fluent, AddSubdiagnostic, DiagnosticHandler, ErrorGuaranteed, Handler};
22
use rustc_macros::{SessionDiagnostic, SessionSubdiagnostic};
33
use rustc_session::lint::Level;
44
use rustc_span::{Span, Symbol};
@@ -119,7 +119,7 @@ pub struct CheckNameUnknown {
119119
pub sub: RequestedLevel,
120120
}
121121

122-
impl SessionDiagnostic<'_> for CheckNameUnknown {
122+
impl DiagnosticHandler<'_> for CheckNameUnknown {
123123
fn into_diagnostic(
124124
self,
125125
handler: &Handler,

compiler/rustc_macros/src/diagnostics/diagnostic.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,15 +81,15 @@ impl<'a> SessionDiagnosticDerive<'a> {
8181
};
8282

8383
structure.gen_impl(quote! {
84-
gen impl<'__session_diagnostic_sess, G>
85-
rustc_errors::SessionDiagnostic<'__session_diagnostic_sess, G>
84+
gen impl<'__diagnostic_handler_sess, G>
85+
rustc_errors::DiagnosticHandler<'__diagnostic_handler_sess, G>
8686
for @Self
8787
where G: rustc_errors::EmissionGuarantee
8888
{
8989
fn into_diagnostic(
9090
self,
91-
#sess: &'__session_diagnostic_sess rustc_errors::Handler
92-
) -> rustc_errors::DiagnosticBuilder<'__session_diagnostic_sess, G> {
91+
#sess: &'__diagnostic_handler_sess rustc_errors::Handler
92+
) -> rustc_errors::DiagnosticBuilder<'__diagnostic_handler_sess, G> {
9393
use rustc_errors::IntoDiagnosticArg;
9494
#implementation
9595
}

compiler/rustc_metadata/src/errors.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::{
33
path::{Path, PathBuf},
44
};
55

6-
use rustc_errors::{error_code, ErrorGuaranteed, SessionDiagnostic};
6+
use rustc_errors::{error_code, DiagnosticHandler, ErrorGuaranteed};
77
use rustc_macros::SessionDiagnostic;
88
use rustc_session::config;
99
use rustc_span::{sym, Span, Symbol};
@@ -421,7 +421,7 @@ pub(crate) struct MultipleCandidates {
421421
pub candidates: Vec<PathBuf>,
422422
}
423423

424-
impl SessionDiagnostic<'_> for MultipleCandidates {
424+
impl DiagnosticHandler<'_> for MultipleCandidates {
425425
fn into_diagnostic(
426426
self,
427427
handler: &'_ rustc_errors::Handler,
@@ -537,7 +537,7 @@ pub struct InvalidMetadataFiles {
537537
pub crate_rejections: Vec<String>,
538538
}
539539

540-
impl SessionDiagnostic<'_> for InvalidMetadataFiles {
540+
impl DiagnosticHandler<'_> for InvalidMetadataFiles {
541541
fn into_diagnostic(
542542
self,
543543
handler: &'_ rustc_errors::Handler,
@@ -565,7 +565,7 @@ pub struct CannotFindCrate {
565565
pub locator_triple: TargetTriple,
566566
}
567567

568-
impl SessionDiagnostic<'_> for CannotFindCrate {
568+
impl DiagnosticHandler<'_> for CannotFindCrate {
569569
fn into_diagnostic(
570570
self,
571571
handler: &'_ rustc_errors::Handler,

compiler/rustc_monomorphize/src/errors.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::path::PathBuf;
22

3+
use rustc_errors::DiagnosticHandler;
34
use rustc_errors::ErrorGuaranteed;
4-
use rustc_errors::SessionDiagnostic;
55
use rustc_macros::{LintDiagnostic, SessionDiagnostic};
66
use rustc_span::Span;
77

@@ -44,7 +44,7 @@ pub struct UnusedGenericParams {
4444
pub param_names: Vec<String>,
4545
}
4646

47-
impl SessionDiagnostic<'_> for UnusedGenericParams {
47+
impl DiagnosticHandler<'_> for UnusedGenericParams {
4848
fn into_diagnostic(
4949
self,
5050
handler: &'_ rustc_errors::Handler,

0 commit comments

Comments
 (0)