Rename ParseSess::span_diagnostic as ParseSess::dcx.
This commit is contained in:
parent
9b1f87c7e8
commit
9df1576e1d
26 changed files with 89 additions and 98 deletions
|
|
@ -641,7 +641,7 @@ pub(crate) fn make_test(
|
|||
// handler. Any errors in the tests will be reported when the test file is compiled,
|
||||
// Note that we still need to cancel the errors above otherwise `DiagnosticBuilder`
|
||||
// will panic on drop.
|
||||
sess.span_diagnostic.reset_err_count();
|
||||
sess.dcx.reset_err_count();
|
||||
|
||||
(found_main, found_extern_crate, found_macro)
|
||||
})
|
||||
|
|
|
|||
|
|
@ -66,9 +66,8 @@ pub(crate) fn look_for_custom_classes<'tcx>(cx: &DocContext<'tcx>, item: &Item)
|
|||
if !tests.custom_classes_found.is_empty() {
|
||||
let span = item.attr_span(cx.tcx);
|
||||
let sess = &cx.tcx.sess.parse_sess;
|
||||
let mut err = sess
|
||||
.span_diagnostic
|
||||
.struct_span_warn(span, "custom classes in code blocks will change behaviour");
|
||||
let mut err =
|
||||
sess.dcx.struct_span_warn(span, "custom classes in code blocks will change behaviour");
|
||||
add_feature_diagnostics_for_issue(
|
||||
&mut err,
|
||||
sess,
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
);
|
||||
|
|
|
|||
|
|
@ -16,8 +16,8 @@ pub(crate) fn parse_lazy_static(
|
|||
($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 @@ pub(crate) fn parse_lazy_static(
|
|||
}
|
||||
Err(err) => {
|
||||
err.cancel();
|
||||
parser.sess.span_diagnostic.reset_err_count();
|
||||
parser.sess.dcx.reset_err_count();
|
||||
return None;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,8 +28,8 @@ 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().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 @@ fn parse_macro_arg<'a, 'b: 'a>(parser: &'a mut Parser<'b>) -> Option<MacroArg> {
|
|||
}
|
||||
Err(e) => {
|
||||
e.cancel();
|
||||
parser.sess.span_diagnostic.reset_err_count();
|
||||
parser.sess.dcx.reset_err_count();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -218,7 +218,7 @@ impl ParseSess {
|
|||
}
|
||||
|
||||
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 @@ impl ParseSess {
|
|||
impl ParseSess {
|
||||
pub(super) fn emit_diagnostics(&self, diagnostics: Vec<Diagnostic>) {
|
||||
for diagnostic in diagnostics {
|
||||
self.parse_sess.span_diagnostic.emit_diagnostic(diagnostic);
|
||||
self.parse_sess.dcx.emit_diagnostic(diagnostic);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -294,11 +294,11 @@ impl ParseSess {
|
|||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue