@@ -170,6 +170,9 @@ pub struct Session {
170
170
/// Data about code being compiled, gathered during compilation.
171
171
pub code_stats : CodeStats ,
172
172
173
+ /// If `-zfuel=crate=n` is specified, `Some(crate)`.
174
+ optimization_fuel_crate : Option < String > ,
175
+
173
176
/// Tracks fuel info if `-zfuel=crate=n` is specified.
174
177
optimization_fuel : Lock < OptimizationFuel > ,
175
178
@@ -883,7 +886,7 @@ impl Session {
883
886
/// This expends fuel if applicable, and records fuel if applicable.
884
887
pub fn consider_optimizing < T : Fn ( ) -> String > ( & self , crate_name : & str , msg : T ) -> bool {
885
888
let mut ret = true ;
886
- if let Some ( c) = self . opts . debugging_opts . fuel . as_ref ( ) . map ( |i| & i . 0 ) {
889
+ if let Some ( ref c) = self . optimization_fuel_crate {
887
890
if c == crate_name {
888
891
assert_eq ! ( self . threads( ) , 1 ) ;
889
892
let mut fuel = self . optimization_fuel . lock ( ) ;
@@ -1254,6 +1257,7 @@ pub fn build_session(
1254
1257
let local_crate_source_file =
1255
1258
local_crate_source_file. map ( |path| file_path_mapping. map_prefix ( path) . 0 ) ;
1256
1259
1260
+ let optimization_fuel_crate = sopts. debugging_opts . fuel . as_ref ( ) . map ( |i| i. 0 . clone ( ) ) ;
1257
1261
let optimization_fuel = Lock :: new ( OptimizationFuel {
1258
1262
remaining : sopts. debugging_opts . fuel . as_ref ( ) . map_or ( 0 , |i| i. 1 ) ,
1259
1263
out_of_fuel : false ,
@@ -1305,6 +1309,7 @@ pub fn build_session(
1305
1309
normalize_projection_ty : AtomicUsize :: new ( 0 ) ,
1306
1310
} ,
1307
1311
code_stats : Default :: default ( ) ,
1312
+ optimization_fuel_crate,
1308
1313
optimization_fuel,
1309
1314
print_fuel,
1310
1315
jobserver : jobserver:: client ( ) ,
0 commit comments