mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-29 20:46:07 +03:00
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:
@@ -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 {
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user