diff options
| author | Mark Rousskov <mark.simulacrum@gmail.com> | 2019-11-19 21:38:31 -0500 |
|---|---|---|
| committer | Mark Rousskov <mark.simulacrum@gmail.com> | 2019-11-20 14:07:57 -0500 |
| commit | 70805e6444c7519167c6fb386586bf1099b502eb (patch) | |
| tree | 1334c81ce16fe89efb309554d12a2dd454df827d /src/libsyntax | |
| parent | 39c0fa847e74e59f96dc6b01d912252f8cdb72eb (diff) | |
| download | rust-70805e6444c7519167c6fb386586bf1099b502eb.tar.gz rust-70805e6444c7519167c6fb386586bf1099b502eb.zip | |
Delete ProcessCfgMod
The previous commit removes the use of this, and now we cleanup.
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/sess.rs | 24 |
1 files changed, 5 insertions, 19 deletions
diff --git a/src/libsyntax/sess.rs b/src/libsyntax/sess.rs index 953f0d1d190..740e9dfe459 100644 --- a/src/libsyntax/sess.rs +++ b/src/libsyntax/sess.rs @@ -1,7 +1,7 @@ //! Contains `ParseSess` which holds state living beyond what one `Parser` might. //! It also serves as an input to the parser itself. -use crate::ast::{CrateConfig, NodeId, Attribute}; +use crate::ast::{CrateConfig, NodeId}; use crate::early_buffered_lints::{BufferedEarlyLint, BufferedEarlyLintId}; use crate::source_map::{SourceMap, FilePathMapping}; use crate::feature_gate::UnstableFeatures; @@ -89,22 +89,10 @@ pub struct ParseSess { pub gated_spans: GatedSpans, /// The parser has reached `Eof` due to an unclosed brace. Used to silence unnecessary errors. pub reached_eof: Lock<bool>, - /// Process the potential `cfg` attributes on a module. - /// Also determine if the module should be included in this configuration. - /// - /// HACK(Centril): This is used to break a cyclic dependency between - /// the parser and cfg-stripping as defined in `syntax_expand::config`. - /// The dependency edge from the parser comes from `parse_item_mod`. - /// A principled solution to this hack would be to implement [#64197]. - /// - /// [#64197]: https://github.com/rust-lang/rust/issues/64197 - pub process_cfg_mod: ProcessCfgMod, } -pub type ProcessCfgMod = fn(&ParseSess, bool, &[Attribute]) -> (bool, Vec<Attribute>); - impl ParseSess { - pub fn new(file_path_mapping: FilePathMapping, process_cfg_mod: ProcessCfgMod) -> Self { + pub fn new(file_path_mapping: FilePathMapping) -> Self { let cm = Lrc::new(SourceMap::new(file_path_mapping)); let handler = Handler::with_tty_emitter( ColorConfig::Auto, @@ -112,17 +100,15 @@ impl ParseSess { None, Some(cm.clone()), ); - ParseSess::with_span_handler(handler, cm, process_cfg_mod) + ParseSess::with_span_handler(handler, cm) } pub fn with_span_handler( handler: Handler, source_map: Lrc<SourceMap>, - process_cfg_mod: ProcessCfgMod, ) -> Self { Self { span_diagnostic: handler, - process_cfg_mod, unstable_features: UnstableFeatures::from_environment(), config: FxHashSet::default(), edition: ExpnId::root().expn_data().edition, @@ -138,10 +124,10 @@ impl ParseSess { } } - pub fn with_silent_emitter(process_cfg_mod: ProcessCfgMod) -> Self { + pub fn with_silent_emitter() -> Self { let cm = Lrc::new(SourceMap::new(FilePathMapping::empty())); let handler = Handler::with_emitter(false, None, Box::new(SilentEmitter)); - ParseSess::with_span_handler(handler, cm, process_cfg_mod) + ParseSess::with_span_handler(handler, cm) } #[inline] |
