From 728c16c88f8db0c914cecc8b20b7f851d936fd5a Mon Sep 17 00:00:00 2001 From: John Kåre Alsaker Date: Wed, 7 Mar 2018 02:43:33 +0100 Subject: Move REGISTERED_DIAGNOSTICS to a ParseSess field --- src/libsyntax/parse/lexer/mod.rs | 3 +++ src/libsyntax/parse/mod.rs | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'src/libsyntax/parse') diff --git a/src/libsyntax/parse/lexer/mod.rs b/src/libsyntax/parse/lexer/mod.rs index 94195ccc72c..cdf38453d7e 100644 --- a/src/libsyntax/parse/lexer/mod.rs +++ b/src/libsyntax/parse/lexer/mod.rs @@ -1764,6 +1764,8 @@ mod tests { use std::collections::HashSet; use std::io; use std::path::PathBuf; + use diagnostics::plugin::ErrorMap; + use rustc_data_structures::sync::Lock; fn mk_sess(cm: Lrc) -> ParseSess { let emitter = errors::emitter::EmitterWriter::new(Box::new(io::sink()), Some(cm.clone()), @@ -1776,6 +1778,7 @@ mod tests { included_mod_stack: RefCell::new(Vec::new()), code_map: cm, missing_fragment_specifiers: RefCell::new(HashSet::new()), + registered_diagnostics: Lock::new(ErrorMap::new()), non_modrs_mods: RefCell::new(vec![]), } } diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs index 1d9af682fec..3fb0c209f70 100644 --- a/src/libsyntax/parse/mod.rs +++ b/src/libsyntax/parse/mod.rs @@ -10,7 +10,7 @@ //! The main parser interface -use rustc_data_structures::sync::Lrc; +use rustc_data_structures::sync::{Lrc, Lock}; use ast::{self, CrateConfig}; use codemap::{CodeMap, FilePathMapping}; use syntax_pos::{self, Span, FileMap, NO_EXPANSION, FileName}; @@ -21,6 +21,7 @@ use ptr::P; use str::char_at; use symbol::Symbol; use tokenstream::{TokenStream, TokenTree}; +use diagnostics::plugin::ErrorMap; use std::cell::RefCell; use std::collections::HashSet; @@ -47,6 +48,8 @@ pub struct ParseSess { pub unstable_features: UnstableFeatures, pub config: CrateConfig, pub missing_fragment_specifiers: RefCell>, + /// The registered diagnostics codes + pub registered_diagnostics: Lock, // Spans where a `mod foo;` statement was included in a non-mod.rs file. // These are used to issue errors if the non_modrs_mods feature is not enabled. pub non_modrs_mods: RefCell>, @@ -71,6 +74,7 @@ impl ParseSess { unstable_features: UnstableFeatures::from_environment(), config: HashSet::new(), missing_fragment_specifiers: RefCell::new(HashSet::new()), + registered_diagnostics: Lock::new(ErrorMap::new()), included_mod_stack: RefCell::new(vec![]), code_map, non_modrs_mods: RefCell::new(vec![]), -- cgit 1.4.1-3-g733a5