Skip to content

Commit 5c4dacd

Browse files
committed
Make REGISTERED_DIAGNOSTICS a global
1 parent 35fbe11 commit 5c4dacd

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/libsyntax/diagnostics/plugin.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
use std::cell::RefCell;
1211
use std::collections::BTreeMap;
1312
use std::env;
1413

@@ -22,6 +21,7 @@ use ptr::P;
2221
use symbol::Symbol;
2322
use tokenstream::{TokenTree};
2423
use util::small_vector::SmallVector;
24+
use rustc_data_structures::sync::Lock;
2525

2626
use diagnostics::metadata::output_metadata;
2727

@@ -30,9 +30,9 @@ pub use errors::*;
3030
// Maximum width of any line in an extended error description (inclusive).
3131
const MAX_DESCRIPTION_WIDTH: usize = 80;
3232

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())
3636
}
3737
}
3838

@@ -48,7 +48,7 @@ pub type ErrorMap = BTreeMap<Name, ErrorInfo>;
4848
fn with_registered_diagnostics<T, F>(f: F) -> T where
4949
F: FnOnce(&mut ErrorMap) -> T,
5050
{
51-
REGISTERED_DIAGNOSTICS.with(move |slot| {
51+
rustc_access_global!(REGISTERED_DIAGNOSTICS, move |slot| {
5252
f(&mut *slot.borrow_mut())
5353
})
5454
}

0 commit comments

Comments
 (0)