]> git.lizzy.rs Git - rust.git/blobdiff - compiler/rustc_session/src/session.rs
Rollup merge of #105423 - oli-obk:symbols, r=jackh726
[rust.git] / compiler / rustc_session / src / session.rs
index fb0b62e025eb33f641d53dc13111d8fa9c61f9f9..4c049a8d628ef0e4336f111cb57c49fddbd3166d 100644 (file)
@@ -538,9 +538,12 @@ pub fn err_count(&self) -> usize {
     pub fn has_errors(&self) -> Option<ErrorGuaranteed> {
         self.diagnostic().has_errors()
     }
-    pub fn has_errors_or_delayed_span_bugs(&self) -> bool {
+    pub fn has_errors_or_delayed_span_bugs(&self) -> Option<ErrorGuaranteed> {
         self.diagnostic().has_errors_or_delayed_span_bugs()
     }
+    pub fn is_compilation_going_to_fail(&self) -> Option<ErrorGuaranteed> {
+        self.diagnostic().is_compilation_going_to_fail()
+    }
     pub fn abort_if_errors(&self) {
         self.diagnostic().abort_if_errors();
     }
@@ -949,6 +952,17 @@ pub fn first_attr_value_str_by_name(
     ) -> Option<Symbol> {
         attrs.iter().find(|at| at.has_name(name)).and_then(|at| at.value_str())
     }
+
+    pub fn diagnostic_width(&self) -> usize {
+        let default_column_width = 140;
+        if let Some(width) = self.opts.diagnostic_width {
+            width
+        } else if self.opts.unstable_opts.ui_testing {
+            default_column_width
+        } else {
+            termize::dimensions().map_or(default_column_width, |(w, _)| w)
+        }
+    }
 }
 
 // JUSTIFICATION: defn of the suggested wrapper fns