X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=compiler%2Frustc_session%2Fsrc%2Fsession.rs;h=4c049a8d628ef0e4336f111cb57c49fddbd3166d;hb=fbfc5ada029dd7892cbdb64a7f6cffee7f898385;hp=d602acec53e3214998c52ffa1f52ca334428f916;hpb=b162bb42707ad1afcd4b8c7fd3bdb6cb1810ae1d;p=rust.git diff --git a/compiler/rustc_session/src/session.rs b/compiler/rustc_session/src/session.rs index d602acec53e..4c049a8d628 100644 --- a/compiler/rustc_session/src/session.rs +++ b/compiler/rustc_session/src/session.rs @@ -538,9 +538,12 @@ pub fn err_count(&self) -> usize { pub fn has_errors(&self) -> Option { self.diagnostic().has_errors() } - pub fn has_errors_or_delayed_span_bugs(&self) -> bool { + pub fn has_errors_or_delayed_span_bugs(&self) -> Option { self.diagnostic().has_errors_or_delayed_span_bugs() } + pub fn is_compilation_going_to_fail(&self) -> Option { + 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 { 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 @@ -1357,7 +1371,7 @@ pub fn build_session( let profiler = SelfProfiler::new( directory, sopts.crate_name.as_deref(), - sopts.unstable_opts.self_profile_events.as_ref().map(|xs| &xs[..]), + sopts.unstable_opts.self_profile_events.as_deref(), &sopts.unstable_opts.self_profile_counter, ); match profiler { @@ -1391,7 +1405,7 @@ pub fn build_session( local_crate_source_file.map(|path| file_path_mapping.map_prefix(path).0); let optimization_fuel = Lock::new(OptimizationFuel { - remaining: sopts.unstable_opts.fuel.as_ref().map_or(0, |i| i.1), + remaining: sopts.unstable_opts.fuel.as_ref().map_or(0, |&(_, i)| i), out_of_fuel: false, }); let print_fuel = AtomicU64::new(0);