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>
This commit is contained in:
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user