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 | c1d351f6eee7f870ce5216e824709dccbdf69dff (patch) | |
| tree | d43ac86e04b45e9887156cdc4132c6f84a698e79 | |
| parent | a918d8b55bd7ec9bbec0c01c1362e842342d7729 (diff) | |
| download | rust-c1d351f6eee7f870ce5216e824709dccbdf69dff.tar.gz rust-c1d351f6eee7f870ce5216e824709dccbdf69dff.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.
| -rw-r--r-- | src/parse/macros/lazy_static.rs | 2 | ||||
| -rw-r--r-- | src/parse/macros/mod.rs | 2 | ||||
| -rw-r--r-- | src/parse/session.rs | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/src/parse/macros/lazy_static.rs b/src/parse/macros/lazy_static.rs index 4c541de04be..a8c2feec453 100644 --- a/src/parse/macros/lazy_static.rs +++ b/src/parse/macros/lazy_static.rs @@ -16,7 +16,7 @@ pub(crate) fn parse_lazy_static( ($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 { diff --git a/src/parse/macros/mod.rs b/src/parse/macros/mod.rs index fd738908170..3728f3a19b4 100644 --- a/src/parse/macros/mod.rs +++ b/src/parse/macros/mod.rs @@ -28,7 +28,7 @@ fn parse_macro_arg<'a, 'b: 'a>(parser: &'a mut Parser<'b>) -> Option<MacroArg> { 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. diff --git a/src/parse/session.rs b/src/parse/session.rs index 40a6d708d8c..a34ceed3fc9 100644 --- a/src/parse/session.rs +++ b/src/parse/session.rs @@ -235,7 +235,7 @@ impl ParseSess { } 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) { |
