diff options
| author | bors <bors@rust-lang.org> | 2018-07-24 15:11:56 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2018-07-24 15:11:56 +0000 |
| commit | f498e4ec1b57c3245a2fb8e0d5d836ed56760d2d (patch) | |
| tree | 870ef7d674c7aee50c7d3b59b4dce7053b1589ac /src/libsyntax/parse | |
| parent | 6a3db033ad05f156281d50ee489d727ee0e5d767 (diff) | |
| parent | 10ee0f68a6815fafa69f58daf347f0c2a8339f32 (diff) | |
| download | rust-f498e4ec1b57c3245a2fb8e0d5d836ed56760d2d.tar.gz rust-f498e4ec1b57c3245a2fb8e0d5d836ed56760d2d.zip | |
Auto merge of #51587 - mark-i-m:at_most_once_rep_2018, r=alexcrichton
2018 edition `?` Kleene operator This is my first attempt at implementing the migration lint + 2018 behavior as discussed in #48075 r? @nikomatsakis
Diffstat (limited to 'src/libsyntax/parse')
| -rw-r--r-- | src/libsyntax/parse/lexer/mod.rs | 1 | ||||
| -rw-r--r-- | src/libsyntax/parse/mod.rs | 23 |
2 files changed, 22 insertions, 2 deletions
diff --git a/src/libsyntax/parse/lexer/mod.rs b/src/libsyntax/parse/lexer/mod.rs index 9748e2947ee..4b077aa8dd4 100644 --- a/src/libsyntax/parse/lexer/mod.rs +++ b/src/libsyntax/parse/lexer/mod.rs @@ -1807,6 +1807,7 @@ mod tests { raw_identifier_spans: Lock::new(Vec::new()), registered_diagnostics: Lock::new(ErrorMap::new()), non_modrs_mods: Lock::new(vec![]), + buffered_lints: Lock::new(vec![]), } } diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs index 1754e5f1b9a..d029509f0c1 100644 --- a/src/libsyntax/parse/mod.rs +++ b/src/libsyntax/parse/mod.rs @@ -11,9 +11,10 @@ //! The main parser interface use rustc_data_structures::sync::{Lrc, Lock}; -use ast::{self, CrateConfig}; +use ast::{self, CrateConfig, NodeId}; +use early_buffered_lints::{BufferedEarlyLint, BufferedEarlyLintId}; use codemap::{CodeMap, FilePathMapping}; -use syntax_pos::{Span, FileMap, FileName}; +use syntax_pos::{Span, FileMap, FileName, MultiSpan}; use errors::{Handler, ColorConfig, DiagnosticBuilder}; use feature_gate::UnstableFeatures; use parse::parser::Parser; @@ -57,6 +58,7 @@ pub struct ParseSess { /// Used to determine and report recursive mod inclusions included_mod_stack: Lock<Vec<PathBuf>>, code_map: Lrc<CodeMap>, + pub buffered_lints: Lock<Vec<BufferedEarlyLint>>, } impl ParseSess { @@ -80,12 +82,29 @@ impl ParseSess { included_mod_stack: Lock::new(vec![]), code_map, non_modrs_mods: Lock::new(vec![]), + buffered_lints: Lock::new(vec![]), } } pub fn codemap(&self) -> &CodeMap { &self.code_map } + + pub fn buffer_lint<S: Into<MultiSpan>>(&self, + lint_id: BufferedEarlyLintId, + span: S, + id: NodeId, + msg: &str, + ) { + self.buffered_lints.with_lock(|buffered_lints| { + buffered_lints.push(BufferedEarlyLint{ + span: span.into(), + id, + msg: msg.into(), + lint_id, + }); + }); + } } #[derive(Clone)] |
