@@ -26,7 +26,7 @@ use util::nodemap::{FxHashMap, FxHashSet};
26
26
use util:: common:: { duration_to_secs_str, ErrorReported } ;
27
27
use util:: common:: ProfileQueriesMsg ;
28
28
29
- use rustc_data_structures:: sync:: { Lrc , Lock , OneThread , Once } ;
29
+ use rustc_data_structures:: sync:: { Lrc , Lock , LockCell , OneThread , Once } ;
30
30
31
31
use syntax:: ast:: NodeId ;
32
32
use errors:: { self , DiagnosticBuilder , DiagnosticId } ;
@@ -146,15 +146,15 @@ pub struct Session {
146
146
/// If -zfuel=crate=n is specified, Some(crate).
147
147
optimization_fuel_crate : Option < String > ,
148
148
/// If -zfuel=crate=n is specified, initially set to n. Otherwise 0.
149
- optimization_fuel_limit : Cell < u64 > ,
149
+ optimization_fuel_limit : LockCell < u64 > ,
150
150
/// We're rejecting all further optimizations.
151
- out_of_fuel : Cell < bool > ,
151
+ out_of_fuel : LockCell < bool > ,
152
152
153
153
// The next two are public because the driver needs to read them.
154
154
/// If -zprint-fuel=crate, Some(crate).
155
155
pub print_fuel_crate : Option < String > ,
156
156
/// Always set to zero and incremented so that we can print fuel expended by a crate.
157
- pub print_fuel : Cell < u64 > ,
157
+ pub print_fuel : LockCell < u64 > ,
158
158
159
159
/// Loaded up early on in the initialization of this `Session` to avoid
160
160
/// false positives about a job server in our environment.
@@ -846,6 +846,7 @@ impl Session {
846
846
/// We want to know if we're allowed to do an optimization for crate foo from -z fuel=foo=n.
847
847
/// This expends fuel if applicable, and records fuel if applicable.
848
848
pub fn consider_optimizing < T : Fn ( ) -> String > ( & self , crate_name : & str , msg : T ) -> bool {
849
+ assert ! ( self . query_threads( ) == 1 ) ;
849
850
let mut ret = true ;
850
851
match self . optimization_fuel_crate {
851
852
Some ( ref c) if c == crate_name => {
@@ -1075,9 +1076,9 @@ pub fn build_session_(
1075
1076
1076
1077
let optimization_fuel_crate = sopts. debugging_opts . fuel . as_ref ( ) . map ( |i| i. 0 . clone ( ) ) ;
1077
1078
let optimization_fuel_limit =
1078
- Cell :: new ( sopts. debugging_opts . fuel . as_ref ( ) . map ( |i| i. 1 ) . unwrap_or ( 0 ) ) ;
1079
+ LockCell :: new ( sopts. debugging_opts . fuel . as_ref ( ) . map ( |i| i. 1 ) . unwrap_or ( 0 ) ) ;
1079
1080
let print_fuel_crate = sopts. debugging_opts . print_fuel . clone ( ) ;
1080
- let print_fuel = Cell :: new ( 0 ) ;
1081
+ let print_fuel = LockCell :: new ( 0 ) ;
1081
1082
1082
1083
let working_dir = match env:: current_dir ( ) {
1083
1084
Ok ( dir) => dir,
@@ -1132,7 +1133,7 @@ pub fn build_session_(
1132
1133
optimization_fuel_limit,
1133
1134
print_fuel_crate,
1134
1135
print_fuel,
1135
- out_of_fuel : Cell :: new ( false ) ,
1136
+ out_of_fuel : LockCell :: new ( false ) ,
1136
1137
// Note that this is unsafe because it may misinterpret file descriptors
1137
1138
// on Unix as jobserver file descriptors. We hopefully execute this near
1138
1139
// the beginning of the process though to ensure we don't get false
0 commit comments