Make diagnostic ordering deterministic

This commit is contained in:
Alex Crichton 2015-01-21 14:32:54 -08:00
parent 91cec5b57e
commit 90af72378d
4 changed files with 11 additions and 9 deletions

View File

@ -77,8 +77,6 @@ register_diagnostics! {
E0138,
E0139,
E0152,
E0153,
E0157,
E0158,
E0161,
E0162,

View File

@ -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())

View File

@ -9,6 +9,7 @@
// except according to those terms.
// ignore-android: FIXME(#10381)
// ignore-windows
// min-lldb-version: 310
// compile-flags:-g

View File

@ -8,6 +8,9 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// ignore-android
// ignore-windows
// Regression test for #20797.
use std::default::Default;