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.
This commit is contained in:
mark
2022-01-22 18:49:12 -06:00
parent a918d8b55b
commit c1d351f6ee
3 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -16,7 +16,7 @@ macro_rules! parse_or {
($method:ident $(,)* $($arg:expr),* $(,)*) => {
match parser.$method($($arg,)*) {
Ok(val) => {
if parser.sess.span_diagnostic.has_errors() {
if parser.sess.span_diagnostic.has_errors().is_some() {
parser.sess.span_diagnostic.reset_err_count();
return None;
} else {
+1 -1
View File
@@ -28,7 +28,7 @@ macro_rules! parse_macro_arg {
let mut cloned_parser = (*parser).clone();
match $parser(&mut cloned_parser) {
Ok(x) => {
if parser.sess.span_diagnostic.has_errors() {
if parser.sess.span_diagnostic.has_errors().is_some() {
parser.sess.span_diagnostic.reset_err_count();
} else {
// Parsing succeeded.
+1 -1
View File
@@ -235,7 +235,7 @@ pub(super) fn can_reset_errors(&self) -> bool {
}
pub(super) fn has_errors(&self) -> bool {
self.parse_sess.span_diagnostic.has_errors()
self.parse_sess.span_diagnostic.has_errors().is_some()
}
pub(super) fn reset_errors(&self) {