about summary refs log tree commit diff
path: root/compiler/rustc_errors/src/lib.rs
diff options
context:
space:
mode:
authorDavid Wood <david.wood@huawei.com>2022-03-23 07:34:20 +0000
committerDavid Wood <david.wood@huawei.com>2022-04-05 06:53:39 +0100
commit8c684563a59900d96a4fcadd41e5e92074c13df1 (patch)
tree6ca30a8bac58d182007db189d32231d159013071 /compiler/rustc_errors/src/lib.rs
parenta22cf2af0510b3ec4cbb19c3de11d3d8291349d9 (diff)
downloadrust-8c684563a59900d96a4fcadd41e5e92074c13df1.tar.gz
rust-8c684563a59900d96a4fcadd41e5e92074c13df1.zip
errors: introduce `DiagnosticMessage`
Introduce a `DiagnosticMessage` type that will enable diagnostic
messages to be simple strings or Fluent identifiers.
`DiagnosticMessage` is now used in the implementation of the standard
`DiagnosticBuilder` APIs.

Signed-off-by: David Wood <david.wood@huawei.com>
Diffstat (limited to 'compiler/rustc_errors/src/lib.rs')
-rw-r--r--compiler/rustc_errors/src/lib.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/compiler/rustc_errors/src/lib.rs b/compiler/rustc_errors/src/lib.rs
index ec00910ec8b..0f55ef7a9ec 100644
--- a/compiler/rustc_errors/src/lib.rs
+++ b/compiler/rustc_errors/src/lib.rs
@@ -145,7 +145,7 @@ pub struct CodeSuggestion {
     /// ]
     /// ```
     pub substitutions: Vec<Substitution>,
-    pub msg: String,
+    pub msg: DiagnosticMessage,
     /// Visual representation of this suggestion.
     pub style: SuggestionStyle,
     /// Whether or not the suggestion is approximate
@@ -400,7 +400,9 @@ impl fmt::Display for ExplicitBug {
 
 impl error::Error for ExplicitBug {}
 
-pub use diagnostic::{Diagnostic, DiagnosticId, DiagnosticStyledString, SubDiagnostic};
+pub use diagnostic::{
+    Diagnostic, DiagnosticId, DiagnosticMessage, DiagnosticStyledString, SubDiagnostic,
+};
 pub use diagnostic_builder::{DiagnosticBuilder, EmissionGuarantee};
 use std::backtrace::Backtrace;