Prefer dcx
methods over fields or fields' methods
This commit is contained in:
parent
7e5893019c
commit
c91edc3888
24 changed files with 62 additions and 58 deletions
|
@ -401,7 +401,7 @@ pub fn report_lit_error(
|
|||
valid.then(|| format!("0{}{}", base_char.to_ascii_lowercase(), &suffix[1..]))
|
||||
}
|
||||
|
||||
let dcx = &psess.dcx;
|
||||
let dcx = psess.dcx();
|
||||
match err {
|
||||
LitError::InvalidSuffix(suffix) => {
|
||||
dcx.emit_err(InvalidLiteralSuffix { span, kind: lit.kind.descr(), suffix })
|
||||
|
|
|
@ -106,12 +106,12 @@ pub fn feature_err_issue(
|
|||
|
||||
// Cancel an earlier warning for this same error, if it exists.
|
||||
if let Some(span) = span.primary_span() {
|
||||
if let Some(err) = sess.psess.dcx.steal_non_err(span, StashKey::EarlySyntaxWarning) {
|
||||
if let Some(err) = sess.dcx().steal_non_err(span, StashKey::EarlySyntaxWarning) {
|
||||
err.cancel()
|
||||
}
|
||||
}
|
||||
|
||||
let mut err = sess.psess.dcx.create_err(FeatureGateError { span, explain: explain.into() });
|
||||
let mut err = sess.dcx().create_err(FeatureGateError { span, explain: explain.into() });
|
||||
add_feature_diagnostics_for_issue(&mut err, sess, feature, issue, false, None);
|
||||
err
|
||||
}
|
||||
|
@ -140,7 +140,7 @@ pub fn feature_warn_issue(
|
|||
issue: GateIssue,
|
||||
explain: &'static str,
|
||||
) {
|
||||
let mut err = sess.psess.dcx.struct_span_warn(span, explain);
|
||||
let mut err = sess.dcx().struct_span_warn(span, explain);
|
||||
add_feature_diagnostics_for_issue(&mut err, sess, feature, issue, false, None);
|
||||
|
||||
// Decorate this as a future-incompatibility lint as in rustc_middle::lint::lint_level
|
||||
|
@ -201,7 +201,7 @@ pub fn add_feature_diagnostics_for_issue<G: EmissionGuarantee>(
|
|||
|
||||
/// Info about a parsing session.
|
||||
pub struct ParseSess {
|
||||
pub dcx: DiagCtxt,
|
||||
dcx: DiagCtxt,
|
||||
pub unstable_features: UnstableFeatures,
|
||||
pub config: Cfg,
|
||||
pub check_config: CheckCfg,
|
||||
|
@ -326,4 +326,8 @@ impl ParseSess {
|
|||
// AppendOnlyVec, so we resort to this scheme.
|
||||
self.proc_macro_quoted_spans.iter_enumerated()
|
||||
}
|
||||
|
||||
pub fn dcx(&self) -> &DiagCtxt {
|
||||
&self.dcx
|
||||
}
|
||||
}
|
||||
|
|
|
@ -329,7 +329,7 @@ impl Session {
|
|||
|
||||
#[inline]
|
||||
pub fn dcx(&self) -> &DiagCtxt {
|
||||
&self.psess.dcx
|
||||
self.psess.dcx()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue