diff options
| author | Mark Rousskov <mark.simulacrum@gmail.com> | 2019-11-19 21:35:11 -0500 |
|---|---|---|
| committer | Mark Rousskov <mark.simulacrum@gmail.com> | 2019-11-19 21:35:11 -0500 |
| commit | 39c0fa847e74e59f96dc6b01d912252f8cdb72eb (patch) | |
| tree | 8aeb03506588c284990f6a8920197d84071e83be /src | |
| parent | 618b01f9fa0a6b4e7e2ce5b3409abe104b80c4a8 (diff) | |
| download | rust-39c0fa847e74e59f96dc6b01d912252f8cdb72eb.tar.gz rust-39c0fa847e74e59f96dc6b01d912252f8cdb72eb.zip | |
Move syntax_expand::config to rustc_parse::config
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustc_parse/config.rs (renamed from src/libsyntax_expand/config.rs) | 14 | ||||
| -rw-r--r-- | src/librustc_parse/lib.rs | 2 | ||||
| -rw-r--r-- | src/librustc_parse/parser/module.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax_expand/expand.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax_expand/lib.rs | 2 |
5 files changed, 17 insertions, 5 deletions
diff --git a/src/libsyntax_expand/config.rs b/src/librustc_parse/config.rs index 7b927fb55f9..7ce555ed57a 100644 --- a/src/libsyntax_expand/config.rs +++ b/src/librustc_parse/config.rs @@ -1,4 +1,14 @@ -use rustc_parse::validate_attr; +//! Process the potential `cfg` attributes on a module. +//! Also determine if the module should be included in this configuration. +//! +//! This module properly belongs in syntax_expand, but for now it's tied into +//! parsing, so we leave it here to avoid complicated out-of-line dependencies. +//! +//! A principled solution to this wrong location would be to implement [#64197]. +//! +//! [#64197]: https://github.com/rust-lang/rust/issues/64197 + +use crate::validate_attr; use syntax::attr::HasAttrs; use syntax::feature_gate::{ feature_err, @@ -113,7 +123,7 @@ impl<'a> StripUnconfigured<'a> { return vec![]; } - let res = rustc_parse::parse_in_attr(self.sess, &attr, |p| p.parse_cfg_attr()); + let res = crate::parse_in_attr(self.sess, &attr, |p| p.parse_cfg_attr()); let (cfg_predicate, expanded_attrs) = match res { Ok(result) => result, Err(mut e) => { diff --git a/src/librustc_parse/lib.rs b/src/librustc_parse/lib.rs index 3a983404220..1215c7a199a 100644 --- a/src/librustc_parse/lib.rs +++ b/src/librustc_parse/lib.rs @@ -25,6 +25,8 @@ pub mod parser; use parser::{Parser, emit_unclosed_delims, make_unclosed_delims_error}; pub mod lexer; pub mod validate_attr; +#[macro_use] +pub mod config; #[derive(Clone)] pub struct Directory<'a> { diff --git a/src/librustc_parse/parser/module.rs b/src/librustc_parse/parser/module.rs index 3110f15e80b..1621c9ffc02 100644 --- a/src/librustc_parse/parser/module.rs +++ b/src/librustc_parse/parser/module.rs @@ -41,7 +41,7 @@ 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> { // HACK(Centril): See documentation on `ParseSess::process_cfg_mod`. - let (in_cfg, outer_attrs) = (self.sess.process_cfg_mod)( + let (in_cfg, outer_attrs) = crate::config::process_configure_mod( self.sess, self.cfg_mods, outer_attrs, diff --git a/src/libsyntax_expand/expand.rs b/src/libsyntax_expand/expand.rs index 06aa5deb6e0..2532bbc0fe2 100644 --- a/src/libsyntax_expand/expand.rs +++ b/src/libsyntax_expand/expand.rs @@ -4,7 +4,7 @@ use crate::hygiene::{ExpnId, SyntaxContext, ExpnData, ExpnKind}; use crate::mbe::macro_rules::annotate_err_with_kind; use crate::placeholders::{placeholder, PlaceholderExpander}; use crate::config::StripUnconfigured; -use crate::configure; +use rustc_parse::configure; use rustc_parse::DirectoryOwnership; use rustc_parse::parser::Parser; diff --git a/src/libsyntax_expand/lib.rs b/src/libsyntax_expand/lib.rs index 46d59dd249c..0aa34af7a76 100644 --- a/src/libsyntax_expand/lib.rs +++ b/src/libsyntax_expand/lib.rs @@ -33,7 +33,7 @@ pub use mbe::macro_rules::compile_declarative_macro; pub mod base; pub mod build; pub mod expand; -#[macro_use] pub mod config; +pub use rustc_parse::config; pub mod proc_macro; crate mod mbe; |
