Skip to content

Commit c1d351f

Browse files
committed
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.
1 parent a918d8b commit c1d351f

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

src/parse/macros/lazy_static.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ pub(crate) fn parse_lazy_static(
1616
($method:ident $(,)* $($arg:expr),* $(,)*) => {
1717
match parser.$method($($arg,)*) {
1818
Ok(val) => {
19-
if parser.sess.span_diagnostic.has_errors() {
19+
if parser.sess.span_diagnostic.has_errors().is_some() {
2020
parser.sess.span_diagnostic.reset_err_count();
2121
return None;
2222
} else {

src/parse/macros/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ fn parse_macro_arg<'a, 'b: 'a>(parser: &'a mut Parser<'b>) -> Option<MacroArg> {
2828
let mut cloned_parser = (*parser).clone();
2929
match $parser(&mut cloned_parser) {
3030
Ok(x) => {
31-
if parser.sess.span_diagnostic.has_errors() {
31+
if parser.sess.span_diagnostic.has_errors().is_some() {
3232
parser.sess.span_diagnostic.reset_err_count();
3333
} else {
3434
// Parsing succeeded.

src/parse/session.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ impl ParseSess {
235235
}
236236

237237
pub(super) fn has_errors(&self) -> bool {
238-
self.parse_sess.span_diagnostic.has_errors()
238+
self.parse_sess.span_diagnostic.has_errors().is_some()
239239
}
240240

241241
pub(super) fn reset_errors(&self) {

0 commit comments

Comments
 (0)