@@ -170,6 +170,9 @@ pub struct Session {
170170 /// Data about code being compiled, gathered during compilation.
171171 pub code_stats : CodeStats ,
172172
173+ /// If `-zfuel=crate=n` is specified, `Some(crate)`.
174+ optimization_fuel_crate : Option < String > ,
175+
173176 /// Tracks fuel info if `-zfuel=crate=n` is specified.
174177 optimization_fuel : Lock < OptimizationFuel > ,
175178
@@ -883,7 +886,7 @@ impl Session {
883886 /// This expends fuel if applicable, and records fuel if applicable.
884887 pub fn consider_optimizing < T : Fn ( ) -> String > ( & self , crate_name : & str , msg : T ) -> bool {
885888 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 {
887890 if c == crate_name {
888891 assert_eq ! ( self . threads( ) , 1 ) ;
889892 let mut fuel = self . optimization_fuel . lock ( ) ;
@@ -1254,6 +1257,7 @@ pub fn build_session(
12541257 let local_crate_source_file =
12551258 local_crate_source_file. map ( |path| file_path_mapping. map_prefix ( path) . 0 ) ;
12561259
1260+ let optimization_fuel_crate = sopts. debugging_opts . fuel . as_ref ( ) . map ( |i| i. 0 . clone ( ) ) ;
12571261 let optimization_fuel = Lock :: new ( OptimizationFuel {
12581262 remaining : sopts. debugging_opts . fuel . as_ref ( ) . map_or ( 0 , |i| i. 1 ) ,
12591263 out_of_fuel : false ,
@@ -1305,6 +1309,7 @@ pub fn build_session(
13051309 normalize_projection_ty : AtomicUsize :: new ( 0 ) ,
13061310 } ,
13071311 code_stats : Default :: default ( ) ,
1312+ optimization_fuel_crate,
13081313 optimization_fuel,
13091314 print_fuel,
13101315 jobserver : jobserver:: client ( ) ,
0 commit comments