From 7738d6900790a3fb85e939541e2a8fbc31c4731e Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Sun, 17 Dec 2023 22:25:47 +1100 Subject: [PATCH] Rename `ParseSess::span_diagnostic` as `ParseSess::dcx`. --- src/parse/macros/cfg_if.rs | 2 +- src/parse/macros/lazy_static.rs | 6 +++--- src/parse/macros/mod.rs | 6 +++--- src/parse/session.rs | 8 ++++---- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/parse/macros/cfg_if.rs b/src/parse/macros/cfg_if.rs index cbc4c90b8f9..bafef7b0f46 100644 --- a/src/parse/macros/cfg_if.rs +++ b/src/parse/macros/cfg_if.rs @@ -67,7 +67,7 @@ fn parse_cfg_if_inner<'a>( Ok(None) => continue, Err(err) => { err.cancel(); - parser.sess.span_diagnostic.reset_err_count(); + parser.sess.dcx.reset_err_count(); return Err( "Expected item inside cfg_if block, but failed to parse it as an item", ); diff --git a/src/parse/macros/lazy_static.rs b/src/parse/macros/lazy_static.rs index a8c2feec453..8b1dc6694d6 100644 --- a/src/parse/macros/lazy_static.rs +++ b/src/parse/macros/lazy_static.rs @@ -16,8 +16,8 @@ macro_rules! parse_or { ($method:ident $(,)* $($arg:expr),* $(,)*) => { match parser.$method($($arg,)*) { Ok(val) => { - if parser.sess.span_diagnostic.has_errors().is_some() { - parser.sess.span_diagnostic.reset_err_count(); + if parser.sess.dcx.has_errors().is_some() { + parser.sess.dcx.reset_err_count(); return None; } else { val @@ -25,7 +25,7 @@ macro_rules! parse_or { } Err(err) => { err.cancel(); - parser.sess.span_diagnostic.reset_err_count(); + parser.sess.dcx.reset_err_count(); return None; } } diff --git a/src/parse/macros/mod.rs b/src/parse/macros/mod.rs index 7a802f7a88e..2dd2622174f 100644 --- a/src/parse/macros/mod.rs +++ b/src/parse/macros/mod.rs @@ -28,8 +28,8 @@ 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().is_some() { - parser.sess.span_diagnostic.reset_err_count(); + if parser.sess.dcx.has_errors().is_some() { + parser.sess.dcx.reset_err_count(); } else { // Parsing succeeded. *parser = cloned_parser; @@ -38,7 +38,7 @@ macro_rules! parse_macro_arg { } Err(e) => { e.cancel(); - parser.sess.span_diagnostic.reset_err_count(); + parser.sess.dcx.reset_err_count(); } } }; diff --git a/src/parse/session.rs b/src/parse/session.rs index f4821bcbff4..102ec231776 100644 --- a/src/parse/session.rs +++ b/src/parse/session.rs @@ -218,7 +218,7 @@ pub(crate) fn ignore_file(&self, path: &FileName) -> bool { } pub(crate) fn set_silent_emitter(&mut self) { - self.parse_sess.span_diagnostic = DiagCtxt::with_emitter(silent_emitter()); + self.parse_sess.dcx = DiagCtxt::with_emitter(silent_emitter()); } pub(crate) fn span_to_filename(&self, span: Span) -> FileName { @@ -285,7 +285,7 @@ pub(crate) fn get_original_snippet(&self, file_name: &FileName) -> Option) { for diagnostic in diagnostics { - self.parse_sess.span_diagnostic.emit_diagnostic(diagnostic); + self.parse_sess.dcx.emit_diagnostic(diagnostic); } } @@ -294,11 +294,11 @@ pub(super) fn can_reset_errors(&self) -> bool { } pub(super) fn has_errors(&self) -> bool { - self.parse_sess.span_diagnostic.has_errors().is_some() + self.parse_sess.dcx.has_errors().is_some() } pub(super) fn reset_errors(&self) { - self.parse_sess.span_diagnostic.reset_err_count(); + self.parse_sess.dcx.reset_err_count(); } }