Make diagnostic ordering deterministic
This commit is contained in:
parent
91cec5b57e
commit
90af72378d
4 changed files with 11 additions and 9 deletions
|
@ -9,7 +9,7 @@
|
|||
// except according to those terms.
|
||||
|
||||
use std::cell::RefCell;
|
||||
use std::collections::HashMap;
|
||||
use std::collections::BTreeMap;
|
||||
use ast;
|
||||
use ast::{Ident, Name, TokenTree};
|
||||
use codemap::Span;
|
||||
|
@ -19,18 +19,18 @@ use parse::token;
|
|||
use ptr::P;
|
||||
|
||||
thread_local! {
|
||||
static REGISTERED_DIAGNOSTICS: RefCell<HashMap<Name, Option<Name>>> = {
|
||||
RefCell::new(HashMap::new())
|
||||
static REGISTERED_DIAGNOSTICS: RefCell<BTreeMap<Name, Option<Name>>> = {
|
||||
RefCell::new(BTreeMap::new())
|
||||
}
|
||||
}
|
||||
thread_local! {
|
||||
static USED_DIAGNOSTICS: RefCell<HashMap<Name, Span>> = {
|
||||
RefCell::new(HashMap::new())
|
||||
static USED_DIAGNOSTICS: RefCell<BTreeMap<Name, Span>> = {
|
||||
RefCell::new(BTreeMap::new())
|
||||
}
|
||||
}
|
||||
|
||||
fn with_registered_diagnostics<T, F>(f: F) -> T where
|
||||
F: FnOnce(&mut HashMap<Name, Option<Name>>) -> T,
|
||||
F: FnOnce(&mut BTreeMap<Name, Option<Name>>) -> T,
|
||||
{
|
||||
REGISTERED_DIAGNOSTICS.with(move |slot| {
|
||||
f(&mut *slot.borrow_mut())
|
||||
|
@ -38,7 +38,7 @@ fn with_registered_diagnostics<T, F>(f: F) -> T where
|
|||
}
|
||||
|
||||
fn with_used_diagnostics<T, F>(f: F) -> T where
|
||||
F: FnOnce(&mut HashMap<Name, Span>) -> T,
|
||||
F: FnOnce(&mut BTreeMap<Name, Span>) -> T,
|
||||
{
|
||||
USED_DIAGNOSTICS.with(move |slot| {
|
||||
f(&mut *slot.borrow_mut())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue