about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJhonny Bill Mena <jhonnybillm@gmail.com>2022-09-18 11:46:16 -0400
committerJhonny Bill Mena <jhonnybillm@gmail.com>2022-09-21 11:39:53 -0400
commit191fac68266b73158ff048c83556ea91cbf977fd (patch)
tree5e744529ae1f878b19d5991e43e44a6bc6098ed9
parent19b348fed44342d8addbbb5e8f67cda5dc8d9b95 (diff)
downloadrust-191fac68266b73158ff048c83556ea91cbf977fd.tar.gz
rust-191fac68266b73158ff048c83556ea91cbf977fd.zip
UPDATE - rename AddSubdiagnostic trait to AddToDiagnostic
-rw-r--r--compiler/rustc_ast_lowering/src/errors.rs6
-rw-r--r--compiler/rustc_error_messages/locales/en-US/lint.ftl2
-rw-r--r--compiler/rustc_errors/src/diagnostic.rs4
-rw-r--r--compiler/rustc_errors/src/diagnostic_builder.rs2
-rw-r--r--compiler/rustc_errors/src/lib.rs2
-rw-r--r--compiler/rustc_infer/src/infer/error_reporting/note.rs2
-rw-r--r--compiler/rustc_lint/src/errors.rs6
-rw-r--r--compiler/rustc_lint/src/internal.rs2
-rw-r--r--compiler/rustc_macros/src/diagnostics/subdiagnostic.rs2
-rw-r--r--src/test/ui-fulldeps/internal-lints/diagnostics.rs14
-rw-r--r--src/test/ui-fulldeps/internal-lints/diagnostics.stderr4
11 files changed, 23 insertions, 23 deletions
diff --git a/compiler/rustc_ast_lowering/src/errors.rs b/compiler/rustc_ast_lowering/src/errors.rs
index 3f3024eb2b8..75f20b07277 100644
--- a/compiler/rustc_ast_lowering/src/errors.rs
+++ b/compiler/rustc_ast_lowering/src/errors.rs
@@ -1,4 +1,4 @@
-use rustc_errors::{fluent, AddSubdiagnostic, Applicability, Diagnostic, DiagnosticArgFromDisplay};
+use rustc_errors::{fluent, AddToDiagnostic, Applicability, Diagnostic, DiagnosticArgFromDisplay};
 use rustc_macros::{DiagnosticHandler, SessionSubdiagnostic};
 use rustc_span::{symbol::Ident, Span, Symbol};
 
@@ -18,7 +18,7 @@ pub struct UseAngleBrackets {
     pub close_param: Span,
 }
 
-impl AddSubdiagnostic for UseAngleBrackets {
+impl AddToDiagnostic for UseAngleBrackets {
     fn add_to_diagnostic(self, diag: &mut Diagnostic) {
         diag.multipart_suggestion(
             fluent::ast_lowering::use_angle_brackets,
@@ -54,7 +54,7 @@ pub enum AssocTyParenthesesSub {
     NotEmpty { open_param: Span, close_param: Span },
 }
 
-impl AddSubdiagnostic for AssocTyParenthesesSub {
+impl AddToDiagnostic for AssocTyParenthesesSub {
     fn add_to_diagnostic(self, diag: &mut Diagnostic) {
         match self {
             Self::Empty { parentheses_span } => diag.multipart_suggestion(
diff --git a/compiler/rustc_error_messages/locales/en-US/lint.ftl b/compiler/rustc_error_messages/locales/en-US/lint.ftl
index 6cc0cb49e1f..80b0b1a8904 100644
--- a/compiler/rustc_error_messages/locales/en-US/lint.ftl
+++ b/compiler/rustc_error_messages/locales/en-US/lint.ftl
@@ -51,7 +51,7 @@ lint_non_existant_doc_keyword = found non-existing keyword `{$keyword}` used in
     .help = only existing keywords are allowed in core/std
 
 lint_diag_out_of_impl =
-    diagnostics should only be created in `IntoDiagnostic`/`AddSubdiagnostic` impls
+    diagnostics should only be created in `IntoDiagnostic`/`AddToDiagnostic` impls
 
 lint_untranslatable_diag = diagnostics should be created using translatable messages
 
diff --git a/compiler/rustc_errors/src/diagnostic.rs b/compiler/rustc_errors/src/diagnostic.rs
index 8a56068fcc7..d3a263ac56d 100644
--- a/compiler/rustc_errors/src/diagnostic.rs
+++ b/compiler/rustc_errors/src/diagnostic.rs
@@ -178,7 +178,7 @@ impl IntoDiagnosticArg for hir::ConstContext {
 /// Trait implemented by error types. This should not be implemented manually. Instead, use
 /// `#[derive(SessionSubdiagnostic)]` -- see [rustc_macros::SessionSubdiagnostic].
 #[rustc_diagnostic_item = "AddSubdiagnostic"]
-pub trait AddSubdiagnostic {
+pub trait AddToDiagnostic {
     /// Add a subdiagnostic to an existing diagnostic.
     fn add_to_diagnostic(self, diag: &mut Diagnostic);
 }
@@ -893,7 +893,7 @@ impl Diagnostic {
 
     /// Add a subdiagnostic from a type that implements `SessionSubdiagnostic` - see
     /// [rustc_macros::SessionSubdiagnostic].
-    pub fn subdiagnostic(&mut self, subdiagnostic: impl AddSubdiagnostic) -> &mut Self {
+    pub fn subdiagnostic(&mut self, subdiagnostic: impl AddToDiagnostic) -> &mut Self {
         subdiagnostic.add_to_diagnostic(self);
         self
     }
diff --git a/compiler/rustc_errors/src/diagnostic_builder.rs b/compiler/rustc_errors/src/diagnostic_builder.rs
index b646dd662cb..209a50fd306 100644
--- a/compiler/rustc_errors/src/diagnostic_builder.rs
+++ b/compiler/rustc_errors/src/diagnostic_builder.rs
@@ -580,7 +580,7 @@ impl<'a, G: EmissionGuarantee> DiagnosticBuilder<'a, G> {
 
     forward!(pub fn subdiagnostic(
         &mut self,
-        subdiagnostic: impl crate::AddSubdiagnostic
+        subdiagnostic: impl crate::AddToDiagnostic
     ) -> &mut Self);
 }
 
diff --git a/compiler/rustc_errors/src/lib.rs b/compiler/rustc_errors/src/lib.rs
index aed52bce9aa..19cae2c9077 100644
--- a/compiler/rustc_errors/src/lib.rs
+++ b/compiler/rustc_errors/src/lib.rs
@@ -371,7 +371,7 @@ impl fmt::Display for ExplicitBug {
 impl error::Error for ExplicitBug {}
 
 pub use diagnostic::{
-    AddSubdiagnostic, DecorateLint, Diagnostic, DiagnosticArg, DiagnosticArgFromDisplay,
+    AddToDiagnostic, DecorateLint, Diagnostic, DiagnosticArg, DiagnosticArgFromDisplay,
     DiagnosticArgValue, DiagnosticId, DiagnosticStyledString, IntoDiagnosticArg, SubDiagnostic,
 };
 pub use diagnostic_builder::{DiagnosticBuilder, EmissionGuarantee, LintDiagnosticBuilder};
diff --git a/compiler/rustc_infer/src/infer/error_reporting/note.rs b/compiler/rustc_infer/src/infer/error_reporting/note.rs
index adaa47c0140..286cfb64a1e 100644
--- a/compiler/rustc_infer/src/infer/error_reporting/note.rs
+++ b/compiler/rustc_infer/src/infer/error_reporting/note.rs
@@ -2,7 +2,7 @@ use crate::errors::RegionOriginNote;
 use crate::infer::error_reporting::note_and_explain_region;
 use crate::infer::{self, InferCtxt, SubregionOrigin};
 use rustc_errors::{
-    fluent, struct_span_err, AddSubdiagnostic, Diagnostic, DiagnosticBuilder, ErrorGuaranteed,
+    fluent, struct_span_err, AddToDiagnostic, Diagnostic, DiagnosticBuilder, ErrorGuaranteed,
 };
 use rustc_middle::traits::ObligationCauseCode;
 use rustc_middle::ty::error::TypeError;
diff --git a/compiler/rustc_lint/src/errors.rs b/compiler/rustc_lint/src/errors.rs
index 261570acb7b..e5670833898 100644
--- a/compiler/rustc_lint/src/errors.rs
+++ b/compiler/rustc_lint/src/errors.rs
@@ -1,4 +1,4 @@
-use rustc_errors::{fluent, AddSubdiagnostic, IntoDiagnostic, ErrorGuaranteed, Handler};
+use rustc_errors::{fluent, AddToDiagnostic, IntoDiagnostic, ErrorGuaranteed, Handler};
 use rustc_macros::{DiagnosticHandler, SessionSubdiagnostic};
 use rustc_session::lint::Level;
 use rustc_span::{Span, Symbol};
@@ -22,7 +22,7 @@ pub enum OverruledAttributeSub {
     CommandLineSource,
 }
 
-impl AddSubdiagnostic for OverruledAttributeSub {
+impl AddToDiagnostic for OverruledAttributeSub {
     fn add_to_diagnostic(self, diag: &mut rustc_errors::Diagnostic) {
         match self {
             OverruledAttributeSub::DefaultSource { id } => {
@@ -87,7 +87,7 @@ pub struct RequestedLevel {
     pub lint_name: String,
 }
 
-impl AddSubdiagnostic for RequestedLevel {
+impl AddToDiagnostic for RequestedLevel {
     fn add_to_diagnostic(self, diag: &mut rustc_errors::Diagnostic) {
         diag.note(fluent::lint::requested_level);
         diag.set_arg(
diff --git a/compiler/rustc_lint/src/internal.rs b/compiler/rustc_lint/src/internal.rs
index dec75c9d380..47da8ec5da1 100644
--- a/compiler/rustc_lint/src/internal.rs
+++ b/compiler/rustc_lint/src/internal.rs
@@ -372,7 +372,7 @@ declare_tool_lint! {
 declare_tool_lint! {
     pub rustc::DIAGNOSTIC_OUTSIDE_OF_IMPL,
     Allow,
-    "prevent creation of diagnostics outside of `DiagnosticHandler`/`AddSubdiagnostic` impls",
+    "prevent creation of diagnostics outside of `DiagnosticHandler`/`AddToDiagnostic` impls",
     report_in_external_macro: true
 }
 
diff --git a/compiler/rustc_macros/src/diagnostics/subdiagnostic.rs b/compiler/rustc_macros/src/diagnostics/subdiagnostic.rs
index dce5d3cfb84..f1bb7feb062 100644
--- a/compiler/rustc_macros/src/diagnostics/subdiagnostic.rs
+++ b/compiler/rustc_macros/src/diagnostics/subdiagnostic.rs
@@ -166,7 +166,7 @@ impl<'a> SessionSubdiagnosticDerive<'a> {
         };
 
         let ret = structure.gen_impl(quote! {
-            gen impl rustc_errors::AddSubdiagnostic for @Self {
+            gen impl rustc_errors::AddToDiagnostic for @Self {
                 fn add_to_diagnostic(self, #diag: &mut rustc_errors::Diagnostic) {
                     use rustc_errors::{Applicability, IntoDiagnosticArg};
                     #implementation
diff --git a/src/test/ui-fulldeps/internal-lints/diagnostics.rs b/src/test/ui-fulldeps/internal-lints/diagnostics.rs
index 1ead987ec41..e95ab048db3 100644
--- a/src/test/ui-fulldeps/internal-lints/diagnostics.rs
+++ b/src/test/ui-fulldeps/internal-lints/diagnostics.rs
@@ -12,7 +12,7 @@ extern crate rustc_session;
 extern crate rustc_span;
 
 use rustc_errors::{
-    AddSubdiagnostic, IntoDiagnostic, Diagnostic, DiagnosticBuilder,
+    AddToDiagnostic, IntoDiagnostic, Diagnostic, DiagnosticBuilder,
     ErrorGuaranteed, Handler, fluent
 };
 use rustc_macros::{DiagnosticHandler, SessionSubdiagnostic};
@@ -49,18 +49,18 @@ impl<'a> IntoDiagnostic<'a, ErrorGuaranteed> for TranslatableInSessionDiagnostic
     }
 }
 
-pub struct UntranslatableInAddSubdiagnostic;
+pub struct UntranslatableInAddToDiagnostic;
 
-impl AddSubdiagnostic for UntranslatableInAddSubdiagnostic {
+impl AddToDiagnostic for UntranslatableInAddToDiagnostic {
     fn add_to_diagnostic(self, diag: &mut Diagnostic) {
         diag.note("untranslatable diagnostic");
         //~^ ERROR diagnostics should be created using translatable messages
     }
 }
 
-pub struct TranslatableInAddSubdiagnostic;
+pub struct TranslatableInAddToDiagnostic;
 
-impl AddSubdiagnostic for TranslatableInAddSubdiagnostic {
+impl AddToDiagnostic for TranslatableInAddToDiagnostic {
     fn add_to_diagnostic(self, diag: &mut Diagnostic) {
         diag.note(fluent::typeck::note);
     }
@@ -68,10 +68,10 @@ impl AddSubdiagnostic for TranslatableInAddSubdiagnostic {
 
 pub fn make_diagnostics<'a>(handler: &'a Handler) {
     let _diag = handler.struct_err(fluent::parser::expect_path);
-    //~^ ERROR diagnostics should only be created in `IntoDiagnostic`/`AddSubdiagnostic` impls
+    //~^ ERROR diagnostics should only be created in `IntoDiagnostic`/`AddToDiagnostic` impls
 
     let _diag = handler.struct_err("untranslatable diagnostic");
-    //~^ ERROR diagnostics should only be created in `IntoDiagnostic`/`AddSubdiagnostic` impls
+    //~^ ERROR diagnostics should only be created in `IntoDiagnostic`/`AddToDiagnostic` impls
     //~^^ ERROR diagnostics should be created using translatable messages
 }
 
diff --git a/src/test/ui-fulldeps/internal-lints/diagnostics.stderr b/src/test/ui-fulldeps/internal-lints/diagnostics.stderr
index d5833cf3970..9219d09e9b4 100644
--- a/src/test/ui-fulldeps/internal-lints/diagnostics.stderr
+++ b/src/test/ui-fulldeps/internal-lints/diagnostics.stderr
@@ -16,7 +16,7 @@ error: diagnostics should be created using translatable messages
 LL |         diag.note("untranslatable diagnostic");
    |              ^^^^
 
-error: diagnostics should only be created in `IntoDiagnostic`/`AddSubdiagnostic` impls
+error: diagnostics should only be created in `IntoDiagnostic`/`AddToDiagnostic` impls
   --> $DIR/diagnostics.rs:70:25
    |
 LL |     let _diag = handler.struct_err(fluent::parser::expect_path);
@@ -28,7 +28,7 @@ note: the lint level is defined here
 LL | #![deny(rustc::diagnostic_outside_of_impl)]
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-error: diagnostics should only be created in `IntoDiagnostic`/`AddSubdiagnostic` impls
+error: diagnostics should only be created in `IntoDiagnostic`/`AddToDiagnostic` impls
   --> $DIR/diagnostics.rs:73:25
    |
 LL |     let _diag = handler.struct_err("untranslatable diagnostic");