@@ -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 } ;
29
+ use rustc_data_structures:: sync:: { Lrc , Lock , OneThread } ;
30
30
31
31
use syntax:: ast:: NodeId ;
32
32
use errors:: { self , DiagnosticBuilder , DiagnosticId } ;
@@ -80,8 +80,12 @@ pub struct Session {
80
80
/// The directory the compiler has been executed in plus a flag indicating
81
81
/// if the value stored here has been affected by path remapping.
82
82
pub working_dir : ( PathBuf , bool ) ,
83
- pub lint_store : RefCell < lint:: LintStore > ,
84
- pub buffered_lints : RefCell < Option < lint:: LintBuffer > > ,
83
+
84
+ // FIXME: lint_store and buffered_lints are not thread-safe,
85
+ // but are only used in a single thread
86
+ pub lint_store : OneThread < RefCell < lint:: LintStore > > ,
87
+ pub buffered_lints : OneThread < RefCell < Option < lint:: LintBuffer > > > ,
88
+
85
89
/// Set of (DiagnosticId, Option<Span>, message) tuples tracking
86
90
/// (sub)diagnostics that have been set once, but should not be set again,
87
91
/// in order to avoid redundantly verbose output (Issue #24690, #44953).
@@ -1134,8 +1138,8 @@ pub fn build_session_(
1134
1138
default_sysroot,
1135
1139
local_crate_source_file,
1136
1140
working_dir,
1137
- lint_store : RefCell :: new ( lint:: LintStore :: new ( ) ) ,
1138
- buffered_lints : RefCell :: new ( Some ( lint:: LintBuffer :: new ( ) ) ) ,
1141
+ lint_store : OneThread :: new ( RefCell :: new ( lint:: LintStore :: new ( ) ) ) ,
1142
+ buffered_lints : OneThread :: new ( RefCell :: new ( Some ( lint:: LintBuffer :: new ( ) ) ) ) ,
1139
1143
one_time_diagnostics : RefCell :: new ( FxHashSet ( ) ) ,
1140
1144
plugin_llvm_passes : RefCell :: new ( Vec :: new ( ) ) ,
1141
1145
plugin_attributes : RefCell :: new ( Vec :: new ( ) ) ,
0 commit comments