about summary refs log tree commit diff
path: root/compiler/rustc_parse/src
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_parse/src
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_parse/src')
-rw-r--r--compiler/rustc_parse/src/parser/item.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/compiler/rustc_parse/src/parser/item.rs b/compiler/rustc_parse/src/parser/item.rs
index e55bdb0e553..fd4b00de392 100644
--- a/compiler/rustc_parse/src/parser/item.rs
+++ b/compiler/rustc_parse/src/parser/item.rs
@@ -1010,7 +1010,8 @@ impl<'a> Parser<'a> {
                 let current_qual_sp = self.prev_token.span;
                 let current_qual_sp = current_qual_sp.to(sp_start);
                 if let Ok(current_qual) = self.span_to_snippet(current_qual_sp) {
-                    if err.message() == "expected `{`, found keyword `unsafe`" {
+                    // FIXME(davidtwco): avoid depending on the error message text
+                    if err.message().as_str() == "expected `{`, found keyword `unsafe`" {
                         let invalid_qual_sp = self.token.uninterpolated_span();
                         let invalid_qual = self.span_to_snippet(invalid_qual_sp).unwrap();