Reapply "Remove optimization_fuel_crate from Session"

This commit is contained in:
bjorn3 2021-08-30 14:36:24 +02:00 committed by Tomasz Miąsko
parent 83f147b3ba
commit 42e9dfd75d

View File

@ -169,9 +169,6 @@ pub struct Session {
/// Data about code being compiled, gathered during compilation. /// Data about code being compiled, gathered during compilation.
pub code_stats: CodeStats, pub code_stats: CodeStats,
/// If `-zfuel=crate=n` is specified, `Some(crate)`.
optimization_fuel_crate: Option<String>,
/// Tracks fuel info if `-zfuel=crate=n` is specified. /// Tracks fuel info if `-zfuel=crate=n` is specified.
optimization_fuel: Lock<OptimizationFuel>, optimization_fuel: Lock<OptimizationFuel>,
@ -896,7 +893,7 @@ pub fn print_perf_stats(&self) {
/// This expends fuel if applicable, and records fuel if applicable. /// This expends fuel if applicable, and records fuel if applicable.
pub fn consider_optimizing<T: Fn() -> String>(&self, crate_name: &str, msg: T) -> bool { pub fn consider_optimizing<T: Fn() -> String>(&self, crate_name: &str, msg: T) -> bool {
let mut ret = true; let mut ret = true;
if let Some(ref c) = self.optimization_fuel_crate { if let Some((ref c, _)) = self.opts.debugging_opts.fuel {
if c == crate_name { if c == crate_name {
assert_eq!(self.threads(), 1); assert_eq!(self.threads(), 1);
let mut fuel = self.optimization_fuel.lock(); let mut fuel = self.optimization_fuel.lock();
@ -1274,7 +1271,6 @@ pub fn build_session(
let local_crate_source_file = let local_crate_source_file =
local_crate_source_file.map(|path| file_path_mapping.map_prefix(path).0); local_crate_source_file.map(|path| file_path_mapping.map_prefix(path).0);
let optimization_fuel_crate = sopts.debugging_opts.fuel.as_ref().map(|i| i.0.clone());
let optimization_fuel = Lock::new(OptimizationFuel { let optimization_fuel = Lock::new(OptimizationFuel {
remaining: sopts.debugging_opts.fuel.as_ref().map_or(0, |i| i.1), remaining: sopts.debugging_opts.fuel.as_ref().map_or(0, |i| i.1),
out_of_fuel: false, out_of_fuel: false,
@ -1326,7 +1322,6 @@ pub fn build_session(
normalize_projection_ty: AtomicUsize::new(0), normalize_projection_ty: AtomicUsize::new(0),
}, },
code_stats: Default::default(), code_stats: Default::default(),
optimization_fuel_crate,
optimization_fuel, optimization_fuel,
print_fuel, print_fuel,
jobserver: jobserver::client(), jobserver: jobserver::client(),