Move syntax_expand::config to rustc_parse::config
This commit is contained in:
parent
618b01f9fa
commit
39c0fa847e
5 changed files with 17 additions and 5 deletions
|
@ -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::attr::HasAttrs;
|
||||||
use syntax::feature_gate::{
|
use syntax::feature_gate::{
|
||||||
feature_err,
|
feature_err,
|
||||||
|
@ -113,7 +123,7 @@ impl<'a> StripUnconfigured<'a> {
|
||||||
return vec![];
|
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 {
|
let (cfg_predicate, expanded_attrs) = match res {
|
||||||
Ok(result) => result,
|
Ok(result) => result,
|
||||||
Err(mut e) => {
|
Err(mut e) => {
|
|
@ -25,6 +25,8 @@ pub mod parser;
|
||||||
use parser::{Parser, emit_unclosed_delims, make_unclosed_delims_error};
|
use parser::{Parser, emit_unclosed_delims, make_unclosed_delims_error};
|
||||||
pub mod lexer;
|
pub mod lexer;
|
||||||
pub mod validate_attr;
|
pub mod validate_attr;
|
||||||
|
#[macro_use]
|
||||||
|
pub mod config;
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct Directory<'a> {
|
pub struct Directory<'a> {
|
||||||
|
|
|
@ -41,7 +41,7 @@ impl<'a> Parser<'a> {
|
||||||
/// Parses a `mod <foo> { ... }` or `mod <foo>;` item.
|
/// Parses a `mod <foo> { ... }` or `mod <foo>;` item.
|
||||||
pub(super) fn parse_item_mod(&mut self, outer_attrs: &[Attribute]) -> PResult<'a, ItemInfo> {
|
pub(super) fn parse_item_mod(&mut self, outer_attrs: &[Attribute]) -> PResult<'a, ItemInfo> {
|
||||||
// HACK(Centril): See documentation on `ParseSess::process_cfg_mod`.
|
// 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.sess,
|
||||||
self.cfg_mods,
|
self.cfg_mods,
|
||||||
outer_attrs,
|
outer_attrs,
|
||||||
|
|
|
@ -4,7 +4,7 @@ use crate::hygiene::{ExpnId, SyntaxContext, ExpnData, ExpnKind};
|
||||||
use crate::mbe::macro_rules::annotate_err_with_kind;
|
use crate::mbe::macro_rules::annotate_err_with_kind;
|
||||||
use crate::placeholders::{placeholder, PlaceholderExpander};
|
use crate::placeholders::{placeholder, PlaceholderExpander};
|
||||||
use crate::config::StripUnconfigured;
|
use crate::config::StripUnconfigured;
|
||||||
use crate::configure;
|
use rustc_parse::configure;
|
||||||
|
|
||||||
use rustc_parse::DirectoryOwnership;
|
use rustc_parse::DirectoryOwnership;
|
||||||
use rustc_parse::parser::Parser;
|
use rustc_parse::parser::Parser;
|
||||||
|
|
|
@ -33,7 +33,7 @@ pub use mbe::macro_rules::compile_declarative_macro;
|
||||||
pub mod base;
|
pub mod base;
|
||||||
pub mod build;
|
pub mod build;
|
||||||
pub mod expand;
|
pub mod expand;
|
||||||
#[macro_use] pub mod config;
|
pub use rustc_parse::config;
|
||||||
pub mod proc_macro;
|
pub mod proc_macro;
|
||||||
|
|
||||||
crate mod mbe;
|
crate mod mbe;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue