Skip to content

Commit adc3451

Browse files
committed
{rustc_parse -> rustc_expand}::config
1 parent 1b527ae commit adc3451

File tree

5 files changed

+8
-16
lines changed

5 files changed

+8
-16
lines changed

src/librustc_parse/config.rs renamed to src/librustc_expand/config.rs

+3-11
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,5 @@
1-
//! Process the potential `cfg` attributes on a module.
2-
//! Also determine if the module should be included in this configuration.
3-
//!
4-
//! This module properly belongs in rustc_expand, but for now it's tied into
5-
//! parsing, so we leave it here to avoid complicated out-of-line dependencies.
6-
//!
7-
//! A principled solution to this wrong location would be to implement [#64197].
8-
//!
9-
//! [#64197]: https://github.com/rust-lang/rust/issues/64197
10-
11-
use crate::{parse_in, validate_attr};
1+
//! Conditional compilation stripping.
2+
123
use rustc_ast::ast::{self, AttrItem, Attribute, MetaItem};
134
use rustc_ast::attr::HasAttrs;
145
use rustc_ast::mut_visit::*;
@@ -21,6 +12,7 @@ use rustc_feature::{Feature, Features, State as FeatureState};
2112
use rustc_feature::{
2213
ACCEPTED_FEATURES, ACTIVE_FEATURES, REMOVED_FEATURES, STABLE_REMOVED_FEATURES,
2314
};
15+
use rustc_parse::{parse_in, validate_attr};
2416
use rustc_session::parse::{feature_err, ParseSess};
2517
use rustc_span::edition::{Edition, ALL_EDITIONS};
2618
use rustc_span::symbol::{sym, Symbol};

src/librustc_expand/expand.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use crate::base::*;
22
use crate::config::StripUnconfigured;
3+
use crate::configure;
34
use crate::hygiene::{ExpnData, ExpnId, ExpnKind, SyntaxContext};
45
use crate::mbe::macro_rules::annotate_err_with_kind;
56
use crate::module::{parse_external_mod, push_directory, Directory, DirectoryOwnership};
@@ -18,7 +19,6 @@ use rustc_ast_pretty::pprust;
1819
use rustc_attr::{self as attr, is_builtin_attr, HasAttrs};
1920
use rustc_errors::{Applicability, FatalError, PResult};
2021
use rustc_feature::Features;
21-
use rustc_parse::configure;
2222
use rustc_parse::parser::Parser;
2323
use rustc_parse::validate_attr;
2424
use rustc_session::lint::builtin::UNUSED_DOC_COMMENTS;

src/librustc_expand/lib.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#![feature(bool_to_option)]
12
#![feature(cow_is_borrowed)]
23
#![feature(crate_visibility_modifier)]
34
#![feature(decl_macro)]
@@ -34,9 +35,10 @@ pub use mbe::macro_rules::compile_declarative_macro;
3435
crate use rustc_span::hygiene;
3536
pub mod base;
3637
pub mod build;
38+
#[macro_use]
39+
pub mod config;
3740
pub mod expand;
3841
pub mod module;
39-
pub use rustc_parse::config;
4042
pub mod proc_macro;
4143

4244
crate mod mbe;

src/librustc_parse/lib.rs

-2
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@ pub mod parser;
2424
use parser::{emit_unclosed_delims, make_unclosed_delims_error, Parser};
2525
pub mod lexer;
2626
pub mod validate_attr;
27-
#[macro_use]
28-
pub mod config;
2927

3028
// A bunch of utility functions of the form `parse_<thing>_from_<source>`
3129
// where <thing> includes crate, expr, item, stmt, tts, and one that

src/librustc_parse/validate_attr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ pub fn parse_meta<'a>(sess: &'a ParseSess, attr: &Attribute) -> PResult<'a, Meta
5757
})
5858
}
5959

60-
crate fn check_meta_bad_delim(sess: &ParseSess, span: DelimSpan, delim: MacDelimiter, msg: &str) {
60+
pub fn check_meta_bad_delim(sess: &ParseSess, span: DelimSpan, delim: MacDelimiter, msg: &str) {
6161
if let ast::MacDelimiter::Parenthesis = delim {
6262
return;
6363
}

0 commit comments

Comments
 (0)