about summary refs log tree commit diff
path: root/compiler/rustc_session/src
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2023-12-21 16:26:09 +1100
committerNicholas Nethercote <n.nethercote@gmail.com>2023-12-24 08:17:47 +1100
commit8a9db2545919f945ffbb215e4325917e0bfc5b3a (patch)
tree435bcdd5e90f99b23e52f76535996e27c42ccf06 /compiler/rustc_session/src
parent8af3d8dcabc8970615dd386df7fde13c5794f004 (diff)
downloadrust-8a9db2545919f945ffbb215e4325917e0bfc5b3a.tar.gz
rust-8a9db2545919f945ffbb215e4325917e0bfc5b3a.zip
Remove more `Session` methods that duplicate `DiagCtxt` methods.
Diffstat (limited to 'compiler/rustc_session/src')
-rw-r--r--compiler/rustc_session/src/output.rs2
-rw-r--r--compiler/rustc_session/src/session.rs24
2 files changed, 6 insertions, 20 deletions
diff --git a/compiler/rustc_session/src/output.rs b/compiler/rustc_session/src/output.rs
index bffebd705ba..db976b30404 100644
--- a/compiler/rustc_session/src/output.rs
+++ b/compiler/rustc_session/src/output.rs
@@ -115,7 +115,7 @@ pub fn validate_crate_name(sess: &Session, s: Symbol, sp: Option<Span>) {
     }
 
     if err_count > 0 {
-        sess.abort_if_errors();
+        sess.dcx().abort_if_errors();
     }
 }
 
diff --git a/compiler/rustc_session/src/session.rs b/compiler/rustc_session/src/session.rs
index ec6e8684b29..53dd48ea272 100644
--- a/compiler/rustc_session/src/session.rs
+++ b/compiler/rustc_session/src/session.rs
@@ -279,7 +279,7 @@ impl Session {
             });
 
             // If we should err, make sure we did.
-            if must_err && self.has_errors().is_none() {
+            if must_err && self.dcx().has_errors().is_none() {
                 // We have skipped a feature gate, and not run into other errors... reject.
                 self.dcx().emit_err(errors::NotCircumventFeature);
             }
@@ -323,22 +323,7 @@ impl Session {
         add_feature_diagnostics(&mut err, &self.parse_sess, feature);
         err
     }
-    #[inline]
-    pub fn err_count(&self) -> usize {
-        self.dcx().err_count()
-    }
-    pub fn has_errors(&self) -> Option<ErrorGuaranteed> {
-        self.dcx().has_errors()
-    }
-    pub fn has_errors_or_span_delayed_bugs(&self) -> Option<ErrorGuaranteed> {
-        self.dcx().has_errors_or_span_delayed_bugs()
-    }
-    pub fn is_compilation_going_to_fail(&self) -> Option<ErrorGuaranteed> {
-        self.dcx().is_compilation_going_to_fail()
-    }
-    pub fn abort_if_errors(&self) {
-        self.dcx().abort_if_errors();
-    }
+
     pub fn compile_status(&self) -> Result<(), ErrorGuaranteed> {
         if let Some(reported) = self.dcx().has_errors_or_lint_errors() {
             let _ = self.dcx().emit_stashed_diagnostics();
@@ -347,14 +332,15 @@ impl Session {
             Ok(())
         }
     }
+
     // FIXME(matthewjasper) Remove this method, it should never be needed.
     pub fn track_errors<F, T>(&self, f: F) -> Result<T, ErrorGuaranteed>
     where
         F: FnOnce() -> T,
     {
-        let old_count = self.err_count();
+        let old_count = self.dcx().err_count();
         let result = f();
-        if self.err_count() == old_count {
+        if self.dcx().err_count() == old_count {
             Ok(result)
         } else {
             Err(self.dcx().span_delayed_bug(