Use a dedicated type instead of a reference for the diagnostic context
This paves the way for tracking more state (e.g. error tainting) in the diagnostic context handle
This commit is contained in:
parent
1d1989fdab
commit
0c5a75a61b
@ -67,7 +67,7 @@ fn parse_cfg_if_inner<'a>(
|
||||
Ok(None) => continue,
|
||||
Err(err) => {
|
||||
err.cancel();
|
||||
parser.psess.dcx.reset_err_count();
|
||||
parser.psess.dcx().reset_err_count();
|
||||
return Err(
|
||||
"Expected item inside cfg_if block, but failed to parse it as an item",
|
||||
);
|
||||
|
@ -16,8 +16,8 @@ macro_rules! parse_or {
|
||||
($method:ident $(,)* $($arg:expr),* $(,)*) => {
|
||||
match parser.$method($($arg,)*) {
|
||||
Ok(val) => {
|
||||
if parser.psess.dcx.has_errors().is_some() {
|
||||
parser.psess.dcx.reset_err_count();
|
||||
if parser.psess.dcx().has_errors().is_some() {
|
||||
parser.psess.dcx().reset_err_count();
|
||||
return None;
|
||||
} else {
|
||||
val
|
||||
@ -25,7 +25,7 @@ macro_rules! parse_or {
|
||||
}
|
||||
Err(err) => {
|
||||
err.cancel();
|
||||
parser.psess.dcx.reset_err_count();
|
||||
parser.psess.dcx().reset_err_count();
|
||||
return None;
|
||||
}
|
||||
}
|
||||
|
@ -29,8 +29,8 @@ macro_rules! parse_macro_arg {
|
||||
if Parser::nonterminal_may_begin_with($nt_kind, &cloned_parser.token) {
|
||||
match $try_parse(&mut cloned_parser) {
|
||||
Ok(x) => {
|
||||
if parser.psess.dcx.has_errors().is_some() {
|
||||
parser.psess.dcx.reset_err_count();
|
||||
if parser.psess.dcx().has_errors().is_some() {
|
||||
parser.psess.dcx().reset_err_count();
|
||||
} else {
|
||||
// Parsing succeeded.
|
||||
*parser = cloned_parser;
|
||||
@ -39,7 +39,7 @@ macro_rules! parse_macro_arg {
|
||||
}
|
||||
Err(e) => {
|
||||
e.cancel();
|
||||
parser.psess.dcx.reset_err_count();
|
||||
parser.psess.dcx().reset_err_count();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -210,7 +210,9 @@ pub(crate) fn set_silent_emitter(&mut self) {
|
||||
rustc_driver::DEFAULT_LOCALE_RESOURCES.to_vec(),
|
||||
false,
|
||||
);
|
||||
self.raw_psess.dcx.make_silent(fallback_bundle, None, false);
|
||||
self.raw_psess
|
||||
.dcx()
|
||||
.make_silent(fallback_bundle, None, false);
|
||||
}
|
||||
|
||||
pub(crate) fn span_to_filename(&self, span: Span) -> FileName {
|
||||
@ -286,11 +288,11 @@ pub(super) fn can_reset_errors(&self) -> bool {
|
||||
}
|
||||
|
||||
pub(super) fn has_errors(&self) -> bool {
|
||||
self.raw_psess.dcx.has_errors().is_some()
|
||||
self.raw_psess.dcx().has_errors().is_some()
|
||||
}
|
||||
|
||||
pub(super) fn reset_errors(&self) {
|
||||
self.raw_psess.dcx.reset_err_count();
|
||||
self.raw_psess.dcx().reset_err_count();
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user