diff options
| author | David Wood <david.wood@huawei.com> | 2022-03-23 07:34:20 +0000 |
|---|---|---|
| committer | David Wood <david.wood@huawei.com> | 2022-04-05 06:53:39 +0100 |
| commit | 8c684563a59900d96a4fcadd41e5e92074c13df1 (patch) | |
| tree | 6ca30a8bac58d182007db189d32231d159013071 /compiler/rustc_errors/src/json.rs | |
| parent | a22cf2af0510b3ec4cbb19c3de11d3d8291349d9 (diff) | |
| download | rust-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/json.rs')
| -rw-r--r-- | compiler/rustc_errors/src/json.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/compiler/rustc_errors/src/json.rs b/compiler/rustc_errors/src/json.rs index dc28d1bb452..90f6df2d571 100644 --- a/compiler/rustc_errors/src/json.rs +++ b/compiler/rustc_errors/src/json.rs @@ -346,7 +346,7 @@ struct UnusedExterns<'a, 'b, 'c> { impl Diagnostic { fn from_errors_diagnostic(diag: &crate::Diagnostic, je: &JsonEmitter) -> Diagnostic { let sugg = diag.suggestions.iter().flatten().map(|sugg| Diagnostic { - message: sugg.msg.clone(), + message: sugg.msg.clone().to_string(), code: None, level: "help", spans: DiagnosticSpan::from_suggestion(sugg, je), @@ -385,7 +385,7 @@ impl Diagnostic { let output = String::from_utf8(output).unwrap(); Diagnostic { - message: diag.message(), + message: diag.message().to_string(), code: DiagnosticCode::map_opt_string(diag.code.clone(), je), level: diag.level.to_str(), spans: DiagnosticSpan::from_multispan(&diag.span, je), @@ -402,7 +402,7 @@ impl Diagnostic { fn from_sub_diagnostic(diag: &SubDiagnostic, je: &JsonEmitter) -> Diagnostic { Diagnostic { - message: diag.message(), + message: diag.message().to_string(), code: None, level: diag.level.to_str(), spans: diag |
