8
8
// option. This file may not be copied, modified, or distributed
9
9
// except according to those terms.
10
10
11
- use std:: cell:: RefCell ;
12
11
use std:: collections:: BTreeMap ;
13
12
use std:: env;
14
13
@@ -22,6 +21,7 @@ use ptr::P;
22
21
use symbol:: Symbol ;
23
22
use tokenstream:: { TokenTree } ;
24
23
use util:: small_vector:: SmallVector ;
24
+ use rustc_data_structures:: sync:: Lock ;
25
25
26
26
use diagnostics:: metadata:: output_metadata;
27
27
@@ -30,9 +30,9 @@ pub use errors::*;
30
30
// Maximum width of any line in an extended error description (inclusive).
31
31
const MAX_DESCRIPTION_WIDTH : usize = 80 ;
32
32
33
- thread_local ! {
34
- static REGISTERED_DIAGNOSTICS : RefCell <ErrorMap > = {
35
- RefCell :: new( BTreeMap :: new( ) )
33
+ rustc_global ! {
34
+ static REGISTERED_DIAGNOSTICS : Lock <ErrorMap > = {
35
+ Lock :: new( BTreeMap :: new( ) )
36
36
}
37
37
}
38
38
@@ -48,7 +48,7 @@ pub type ErrorMap = BTreeMap<Name, ErrorInfo>;
48
48
fn with_registered_diagnostics < T , F > ( f : F ) -> T where
49
49
F : FnOnce ( & mut ErrorMap ) -> T ,
50
50
{
51
- REGISTERED_DIAGNOSTICS . with ( move |slot| {
51
+ rustc_access_global ! ( REGISTERED_DIAGNOSTICS , move |slot| {
52
52
f( & mut * slot. borrow_mut( ) )
53
53
} )
54
54
}
0 commit comments