Skip to content
Permalink
Browse files

Move syntax_expand::config to rustc_parse::config

  • Loading branch information
Mark-Simulacrum committed Nov 20, 2019
1 parent 618b01f commit 39c0fa847e74e59f96dc6b01d912252f8cdb72eb
@@ -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) => {
@@ -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> {
@@ -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,
@@ -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;
@@ -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;

0 comments on commit 39c0fa8

Please sign in to comment.
You can’t perform that action at this time.