diff options
| author | mark <markm@cs.wisc.edu> | 2022-01-22 18:49:12 -0600 |
|---|---|---|
| committer | mark <markm@cs.wisc.edu> | 2022-03-16 10:35:24 -0500 |
| commit | bb8d4307eb723850e98bcb52d71d860a4aba220a (patch) | |
| tree | f3215627c474542776bdbcb03f634651a89b70f8 /compiler/rustc_parse/src | |
| parent | 461e8078010433ff7de2db2aaae8a3cfb0847215 (diff) | |
| download | rust-bb8d4307eb723850e98bcb52d71d860a4aba220a.tar.gz rust-bb8d4307eb723850e98bcb52d71d860a4aba220a.zip | |
rustc_error: make ErrorReported impossible to construct
There are a few places were we have to construct it, though, and a few places that are more invasive to change. To do this, we create a constructor with a long obvious name.
Diffstat (limited to 'compiler/rustc_parse/src')
| -rw-r--r-- | compiler/rustc_parse/src/lexer/unescape_error_reporting.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_parse/src/parser/item.rs | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/compiler/rustc_parse/src/lexer/unescape_error_reporting.rs b/compiler/rustc_parse/src/lexer/unescape_error_reporting.rs index c7d166319ea..bec4561928c 100644 --- a/compiler/rustc_parse/src/lexer/unescape_error_reporting.rs +++ b/compiler/rustc_parse/src/lexer/unescape_error_reporting.rs @@ -202,7 +202,7 @@ pub(crate) fn emit_unescape_error( diag.emit(); } EscapeError::TooShortHexEscape => { - handler.span_err(span, "numeric character escape is too short") + handler.span_err(span, "numeric character escape is too short"); } EscapeError::InvalidCharInHexEscape | EscapeError::InvalidCharInUnicodeEscape => { let (c, span) = last_char(); diff --git a/compiler/rustc_parse/src/parser/item.rs b/compiler/rustc_parse/src/parser/item.rs index b582f060395..4d5c552b81b 100644 --- a/compiler/rustc_parse/src/parser/item.rs +++ b/compiler/rustc_parse/src/parser/item.rs @@ -212,10 +212,10 @@ impl<'a> Parser<'a> { if let Err(mut e) = self.expect_semi() { match tree.kind { UseTreeKind::Glob => { - e.note("the wildcard token must be last on the path").emit(); + e.note("the wildcard token must be last on the path"); } UseTreeKind::Nested(..) => { - e.note("glob-like brace syntax must be last on the path").emit(); + e.note("glob-like brace syntax must be last on the path"); } _ => (), } @@ -1485,7 +1485,7 @@ impl<'a> Parser<'a> { // Make sure an error was emitted (either by recovering an angle bracket, // or by finding an identifier as the next token), since we're // going to continue parsing - assert!(self.sess.span_diagnostic.has_errors()); + assert!(self.sess.span_diagnostic.has_errors().is_some()); } else { return Err(err); } |
