From 953d6dfd7e1b1d5c5b17314b6e3bdec15d8e7a01 Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Fri, 16 Jan 2015 15:54:58 -0800 Subject: Make error code registration work again. #19624 --- src/libsyntax/diagnostics/plugin.rs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/libsyntax/diagnostics/plugin.rs') diff --git a/src/libsyntax/diagnostics/plugin.rs b/src/libsyntax/diagnostics/plugin.rs index 1469c50061c..0e99829fa1c 100644 --- a/src/libsyntax/diagnostics/plugin.rs +++ b/src/libsyntax/diagnostics/plugin.rs @@ -65,6 +65,13 @@ pub fn expand_diagnostic_used<'cx>(ecx: &'cx mut ExtCtxt, } () }); + with_registered_diagnostics(|diagnostics| { + if !diagnostics.contains_key(&code.name) { + ecx.span_err(span, &format!( + "used diagnostic code {} not registered", token::get_ident(code).get() + )[]); + } + }); MacExpr::new(quote_expr!(ecx, ())) } -- cgit 1.4.1-3-g733a5 From 90af72378d9f848de78adc5003dff6b90f327b3c Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Wed, 21 Jan 2015 14:32:54 -0800 Subject: Make diagnostic ordering deterministic --- src/librustc/diagnostics.rs | 2 -- src/libsyntax/diagnostics/plugin.rs | 14 +++++++------- src/test/debuginfo/vec-slices.rs | 1 + src/test/run-pass/issue-20797.rs | 3 +++ 4 files changed, 11 insertions(+), 9 deletions(-) (limited to 'src/libsyntax/diagnostics/plugin.rs') diff --git a/src/librustc/diagnostics.rs b/src/librustc/diagnostics.rs index 653ade67b72..b48df36a679 100644 --- a/src/librustc/diagnostics.rs +++ b/src/librustc/diagnostics.rs @@ -77,8 +77,6 @@ register_diagnostics! { E0138, E0139, E0152, - E0153, - E0157, E0158, E0161, E0162, diff --git a/src/libsyntax/diagnostics/plugin.rs b/src/libsyntax/diagnostics/plugin.rs index 0e99829fa1c..bd5247bbad6 100644 --- a/src/libsyntax/diagnostics/plugin.rs +++ b/src/libsyntax/diagnostics/plugin.rs @@ -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>> = { - RefCell::new(HashMap::new()) + static REGISTERED_DIAGNOSTICS: RefCell>> = { + RefCell::new(BTreeMap::new()) } } thread_local! { - static USED_DIAGNOSTICS: RefCell> = { - RefCell::new(HashMap::new()) + static USED_DIAGNOSTICS: RefCell> = { + RefCell::new(BTreeMap::new()) } } fn with_registered_diagnostics(f: F) -> T where - F: FnOnce(&mut HashMap>) -> T, + F: FnOnce(&mut BTreeMap>) -> T, { REGISTERED_DIAGNOSTICS.with(move |slot| { f(&mut *slot.borrow_mut()) @@ -38,7 +38,7 @@ fn with_registered_diagnostics(f: F) -> T where } fn with_used_diagnostics(f: F) -> T where - F: FnOnce(&mut HashMap) -> T, + F: FnOnce(&mut BTreeMap) -> T, { USED_DIAGNOSTICS.with(move |slot| { f(&mut *slot.borrow_mut()) diff --git a/src/test/debuginfo/vec-slices.rs b/src/test/debuginfo/vec-slices.rs index 949dffaac06..3ceb3946f3c 100644 --- a/src/test/debuginfo/vec-slices.rs +++ b/src/test/debuginfo/vec-slices.rs @@ -9,6 +9,7 @@ // except according to those terms. // ignore-android: FIXME(#10381) +// ignore-windows // min-lldb-version: 310 // compile-flags:-g diff --git a/src/test/run-pass/issue-20797.rs b/src/test/run-pass/issue-20797.rs index c4f3c33f269..089b6f31975 100644 --- a/src/test/run-pass/issue-20797.rs +++ b/src/test/run-pass/issue-20797.rs @@ -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; -- cgit 1.4.1-3-g733a5