diff options
| author | Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de> | 2024-06-18 09:43:28 +0000 |
|---|---|---|
| committer | Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de> | 2024-06-18 13:45:08 +0000 |
| commit | c91edc3888073d0ddf2e0ff7741437e483a4f21e (patch) | |
| tree | 31fcf5694ffd807f2b014c2ee464da10051d4486 /compiler/rustc_session/src/parse.rs | |
| parent | 7e5893019cdaa94ebef30a14432db6eb62898500 (diff) | |
| download | rust-c91edc3888073d0ddf2e0ff7741437e483a4f21e.tar.gz rust-c91edc3888073d0ddf2e0ff7741437e483a4f21e.zip | |
Prefer `dcx` methods over fields or fields' methods
Diffstat (limited to 'compiler/rustc_session/src/parse.rs')
| -rw-r--r-- | compiler/rustc_session/src/parse.rs | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/compiler/rustc_session/src/parse.rs b/compiler/rustc_session/src/parse.rs index df07f81bc45..4e5ee39ffb9 100644 --- a/compiler/rustc_session/src/parse.rs +++ b/compiler/rustc_session/src/parse.rs @@ -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 + } } |
