move Directory -> parser::module
This commit is contained in:
parent
f1ca9969bf
commit
ddcc8ec89d
4 changed files with 24 additions and 23 deletions
|
@ -10,7 +10,8 @@ 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::{self, parser, DirectoryOwnership, MACRO_ARGUMENTS};
|
use rustc_parse::parser::module::DirectoryOwnership;
|
||||||
|
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;
|
||||||
use rustc_span::hygiene::{AstPass, ExpnData, ExpnId, ExpnKind};
|
use rustc_span::hygiene::{AstPass, ExpnData, ExpnId, ExpnKind};
|
||||||
|
|
|
@ -18,10 +18,11 @@ 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};
|
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_parse::{Directory, DirectoryOwnership};
|
|
||||||
use rustc_session::lint::builtin::UNUSED_DOC_COMMENTS;
|
use rustc_session::lint::builtin::UNUSED_DOC_COMMENTS;
|
||||||
use rustc_session::lint::BuiltinLintDiagnostics;
|
use rustc_session::lint::BuiltinLintDiagnostics;
|
||||||
use rustc_session::parse::{feature_err, ParseSess};
|
use rustc_session::parse::{feature_err, ParseSess};
|
||||||
|
|
|
@ -14,7 +14,7 @@ use rustc_errors::{Diagnostic, FatalError, Level, PResult};
|
||||||
use rustc_session::parse::ParseSess;
|
use rustc_session::parse::ParseSess;
|
||||||
use rustc_span::{FileName, SourceFile, Span};
|
use rustc_span::{FileName, SourceFile, Span};
|
||||||
|
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::Path;
|
||||||
use std::str;
|
use std::str;
|
||||||
|
|
||||||
use log::info;
|
use log::info;
|
||||||
|
@ -29,22 +29,6 @@ pub mod validate_attr;
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
pub mod config;
|
pub mod config;
|
||||||
|
|
||||||
#[derive(Clone)]
|
|
||||||
pub struct Directory {
|
|
||||||
pub path: PathBuf,
|
|
||||||
pub ownership: DirectoryOwnership,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Copy, Clone)]
|
|
||||||
pub enum DirectoryOwnership {
|
|
||||||
Owned {
|
|
||||||
// None if `mod.rs`, `Some("foo")` if we're in `foo.rs`.
|
|
||||||
relative: Option<ast::Ident>,
|
|
||||||
},
|
|
||||||
UnownedViaBlock,
|
|
||||||
UnownedViaMod,
|
|
||||||
}
|
|
||||||
|
|
||||||
// A bunch of utility functions of the form `parse_<thing>_from_<source>`
|
// A bunch of utility functions of the form `parse_<thing>_from_<source>`
|
||||||
// where <thing> includes crate, expr, item, stmt, tts, and one that
|
// where <thing> includes crate, expr, item, stmt, tts, and one that
|
||||||
// uses a HOF to parse anything, and <source> includes file and
|
// uses a HOF to parse anything, and <source> includes file and
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
use crate::{new_sub_parser_from_file, Directory, DirectoryOwnership};
|
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;
|
use rustc_ast::{attr, token};
|
||||||
use rustc_ast::token;
|
|
||||||
use rustc_errors::{struct_span_err, PResult};
|
use rustc_errors::{struct_span_err, PResult};
|
||||||
use rustc_session::parse::ParseSess;
|
use rustc_session::parse::ParseSess;
|
||||||
use rustc_span::source_map::{FileName, Span};
|
use rustc_span::source_map::{FileName, Span};
|
||||||
|
@ -10,6 +9,22 @@ use rustc_span::symbol::sym;
|
||||||
|
|
||||||
use std::path::{self, Path, PathBuf};
|
use std::path::{self, Path, PathBuf};
|
||||||
|
|
||||||
|
#[derive(Clone)]
|
||||||
|
pub struct Directory {
|
||||||
|
pub path: PathBuf,
|
||||||
|
pub ownership: DirectoryOwnership,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Copy, Clone)]
|
||||||
|
pub enum DirectoryOwnership {
|
||||||
|
Owned {
|
||||||
|
// None if `mod.rs`, `Some("foo")` if we're in `foo.rs`.
|
||||||
|
relative: Option<ast::Ident>,
|
||||||
|
},
|
||||||
|
UnownedViaBlock,
|
||||||
|
UnownedViaMod,
|
||||||
|
}
|
||||||
|
|
||||||
/// Information about the path to a module.
|
/// Information about the path to a module.
|
||||||
// Public for rustfmt usage.
|
// Public for rustfmt usage.
|
||||||
pub struct ModulePath<'a> {
|
pub struct ModulePath<'a> {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue