{rustc_parse::parser -> rustc_expand}::module

This commit is contained in:
Mazdak Farrokhzad 2020-03-08 22:21:37 +01:00
parent ddcc8ec89d
commit 3796faefb1
5 changed files with 7 additions and 10 deletions

View File

@ -1,4 +1,5 @@
use crate::expand::{self, AstFragment, Invocation}; use crate::expand::{self, AstFragment, Invocation};
use crate::module::DirectoryOwnership;
use rustc_ast::ast::{self, Attribute, Name, NodeId, PatKind}; use rustc_ast::ast::{self, Attribute, Name, NodeId, PatKind};
use rustc_ast::mut_visit::{self, MutVisitor}; use rustc_ast::mut_visit::{self, MutVisitor};
@ -10,7 +11,6 @@ use rustc_attr::{self as attr, Deprecation, HasAttrs, Stability};
use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::fx::FxHashMap;
use rustc_data_structures::sync::{self, Lrc}; use rustc_data_structures::sync::{self, Lrc};
use rustc_errors::{DiagnosticBuilder, DiagnosticId}; use rustc_errors::{DiagnosticBuilder, DiagnosticId};
use rustc_parse::parser::module::DirectoryOwnership;
use rustc_parse::{self, parser, MACRO_ARGUMENTS}; use rustc_parse::{self, parser, MACRO_ARGUMENTS};
use rustc_session::parse::ParseSess; use rustc_session::parse::ParseSess;
use rustc_span::edition::Edition; use rustc_span::edition::Edition;

View File

@ -2,6 +2,7 @@ use crate::base::*;
use crate::config::StripUnconfigured; use crate::config::StripUnconfigured;
use crate::hygiene::{ExpnData, ExpnId, ExpnKind, SyntaxContext}; use crate::hygiene::{ExpnData, ExpnId, ExpnKind, SyntaxContext};
use crate::mbe::macro_rules::annotate_err_with_kind; use crate::mbe::macro_rules::annotate_err_with_kind;
use crate::module::{parse_external_mod, push_directory, Directory, DirectoryOwnership};
use crate::placeholders::{placeholder, PlaceholderExpander}; use crate::placeholders::{placeholder, PlaceholderExpander};
use crate::proc_macro::collect_derives; use crate::proc_macro::collect_derives;
@ -18,9 +19,6 @@ use rustc_attr::{self as attr, is_builtin_attr, HasAttrs};
use rustc_errors::{Applicability, FatalError, PResult}; use rustc_errors::{Applicability, FatalError, PResult};
use rustc_feature::Features; use rustc_feature::Features;
use rustc_parse::configure; use rustc_parse::configure;
use rustc_parse::parser::module::{
parse_external_mod, push_directory, Directory, DirectoryOwnership,
};
use rustc_parse::parser::Parser; use rustc_parse::parser::Parser;
use rustc_parse::validate_attr; use rustc_parse::validate_attr;
use rustc_session::lint::builtin::UNUSED_DOC_COMMENTS; use rustc_session::lint::builtin::UNUSED_DOC_COMMENTS;

View File

@ -4,6 +4,7 @@
#![feature(proc_macro_diagnostic)] #![feature(proc_macro_diagnostic)]
#![feature(proc_macro_internals)] #![feature(proc_macro_internals)]
#![feature(proc_macro_span)] #![feature(proc_macro_span)]
#![feature(try_blocks)]
extern crate proc_macro as pm; extern crate proc_macro as pm;
@ -34,6 +35,7 @@ crate use rustc_span::hygiene;
pub mod base; pub mod base;
pub mod build; pub mod build;
pub mod expand; pub mod expand;
pub mod module;
pub use rustc_parse::config; pub use rustc_parse::config;
pub mod proc_macro; pub mod proc_macro;

View File

@ -1,8 +1,7 @@
use crate::new_sub_parser_from_file;
use rustc_ast::ast::{self, Attribute, Ident, Mod}; use rustc_ast::ast::{self, Attribute, Ident, Mod};
use rustc_ast::{attr, token}; use rustc_ast::{attr, token};
use rustc_errors::{struct_span_err, PResult}; use rustc_errors::{struct_span_err, PResult};
use rustc_parse::new_sub_parser_from_file;
use rustc_session::parse::ParseSess; use rustc_session::parse::ParseSess;
use rustc_span::source_map::{FileName, Span}; use rustc_span::source_map::{FileName, Span};
use rustc_span::symbol::sym; use rustc_span::symbol::sym;
@ -39,7 +38,7 @@ pub struct ModulePathSuccess {
pub ownership: DirectoryOwnership, pub ownership: DirectoryOwnership,
} }
pub fn parse_external_mod( crate fn parse_external_mod(
sess: &ParseSess, sess: &ParseSess,
id: ast::Ident, id: ast::Ident,
Directory { mut ownership, path }: Directory, Directory { mut ownership, path }: Directory,
@ -98,7 +97,7 @@ fn error_on_circular_module<'a>(
Ok(()) Ok(())
} }
pub fn push_directory( crate fn push_directory(
id: Ident, id: Ident,
attrs: &[Attribute], attrs: &[Attribute],
Directory { mut ownership, mut path }: Directory, Directory { mut ownership, mut path }: Directory,

View File

@ -1,8 +1,6 @@
pub mod attr; pub mod attr;
mod expr; mod expr;
mod item; mod item;
pub mod module;
pub use module::{ModulePath, ModulePathSuccess};
mod pat; mod pat;
mod path; mod path;
mod ty; mod ty;