about summary refs log tree commit diff
path: root/src/libsyntax/parse/parser/module.rs
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-10-10 10:26:10 +0200
committerMazdak Farrokhzad <twingoow@gmail.com>2019-11-10 02:46:17 +0100
commitbe023ebe850261c6bb202a02a686827d821c3697 (patch)
tree4595cee969fbdb83ffc536ab940e15be2503e454 /src/libsyntax/parse/parser/module.rs
parent5011ec7fedffe34d943654ffb4308875fc5ec8f3 (diff)
downloadrust-be023ebe850261c6bb202a02a686827d821c3697.tar.gz
rust-be023ebe850261c6bb202a02a686827d821c3697.zip
move config.rs to libsyntax_expand
Diffstat (limited to 'src/libsyntax/parse/parser/module.rs')
-rw-r--r--src/libsyntax/parse/parser/module.rs19
1 files changed, 7 insertions, 12 deletions
diff --git a/src/libsyntax/parse/parser/module.rs b/src/libsyntax/parse/parser/module.rs
index 3e5974c2eee..ad72b3a1dea 100644
--- a/src/libsyntax/parse/parser/module.rs
+++ b/src/libsyntax/parse/parser/module.rs
@@ -7,8 +7,8 @@ use crate::ast::{self, Ident, Attribute, ItemKind, Mod, Crate};
 use crate::parse::{new_sub_parser_from_file, DirectoryOwnership};
 use crate::token::{self, TokenKind};
 use crate::source_map::{SourceMap, Span, DUMMY_SP, FileName};
-use crate::symbol::sym;
 
+use syntax_pos::symbol::sym;
 use errors::PResult;
 
 use std::path::{self, Path, PathBuf};
@@ -39,17 +39,12 @@ impl<'a> Parser<'a> {
 
     /// Parses a `mod <foo> { ... }` or `mod <foo>;` item.
     pub(super) fn parse_item_mod(&mut self, outer_attrs: &[Attribute]) -> PResult<'a, ItemInfo> {
-        let (in_cfg, outer_attrs) = {
-            // FIXME(Centril): This results in a cycle between config and parsing.
-            // Consider using dynamic dispatch via `self.sess` to disentangle the knot.
-            let mut strip_unconfigured = crate::config::StripUnconfigured {
-                sess: self.sess,
-                features: None, // Don't perform gated feature checking.
-            };
-            let mut outer_attrs = outer_attrs.to_owned();
-            strip_unconfigured.process_cfg_attrs(&mut outer_attrs);
-            (!self.cfg_mods || strip_unconfigured.in_cfg(&outer_attrs), outer_attrs)
-        };
+        // HACK(Centril): See documentation on `ParseSess::process_cfg_mod`.
+        let (in_cfg, outer_attrs) = (self.sess.process_cfg_mod)(
+            self.sess,
+            self.cfg_mods,
+            outer_attrs,
+        );
 
         let id_span = self.token.span;
         let id = self.parse_ident()?;