Skip to content

Commit 65d072d

Browse files
committed
move Directory -> parser::module
1 parent e994922 commit 65d072d

File tree

4 files changed

+24
-23
lines changed

4 files changed

+24
-23
lines changed

src/librustc_expand/base.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ use rustc_attr::{self as attr, Deprecation, HasAttrs, Stability};
1010
use rustc_data_structures::fx::FxHashMap;
1111
use rustc_data_structures::sync::{self, Lrc};
1212
use rustc_errors::{DiagnosticBuilder, DiagnosticId};
13-
use rustc_parse::{self, parser, DirectoryOwnership, MACRO_ARGUMENTS};
13+
use rustc_parse::parser::module::DirectoryOwnership;
14+
use rustc_parse::{self, parser, MACRO_ARGUMENTS};
1415
use rustc_session::parse::ParseSess;
1516
use rustc_span::edition::Edition;
1617
use rustc_span::hygiene::{AstPass, ExpnData, ExpnId, ExpnKind};

src/librustc_expand/expand.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,11 @@ use rustc_attr::{self as attr, is_builtin_attr, HasAttrs};
1818
use rustc_errors::{Applicability, FatalError, PResult};
1919
use rustc_feature::Features;
2020
use rustc_parse::configure;
21-
use rustc_parse::parser::module::{parse_external_mod, push_directory};
21+
use rustc_parse::parser::module::{
22+
parse_external_mod, push_directory, Directory, DirectoryOwnership,
23+
};
2224
use rustc_parse::parser::Parser;
2325
use rustc_parse::validate_attr;
24-
use rustc_parse::{Directory, DirectoryOwnership};
2526
use rustc_session::lint::builtin::UNUSED_DOC_COMMENTS;
2627
use rustc_session::lint::BuiltinLintDiagnostics;
2728
use rustc_session::parse::{feature_err, ParseSess};

src/librustc_parse/lib.rs

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use rustc_errors::{Diagnostic, FatalError, Level, PResult};
1313
use rustc_session::parse::ParseSess;
1414
use rustc_span::{FileName, SourceFile, Span};
1515

16-
use std::path::{Path, PathBuf};
16+
use std::path::Path;
1717
use std::str;
1818

1919
use log::info;
@@ -28,22 +28,6 @@ pub mod validate_attr;
2828
#[macro_use]
2929
pub mod config;
3030

31-
#[derive(Clone)]
32-
pub struct Directory {
33-
pub path: PathBuf,
34-
pub ownership: DirectoryOwnership,
35-
}
36-
37-
#[derive(Copy, Clone)]
38-
pub enum DirectoryOwnership {
39-
Owned {
40-
// None if `mod.rs`, `Some("foo")` if we're in `foo.rs`.
41-
relative: Option<ast::Ident>,
42-
},
43-
UnownedViaBlock,
44-
UnownedViaMod,
45-
}
46-
4731
// A bunch of utility functions of the form `parse_<thing>_from_<source>`
4832
// where <thing> includes crate, expr, item, stmt, tts, and one that
4933
// uses a HOF to parse anything, and <source> includes file and

src/librustc_parse/parser/module.rs

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,30 @@
1-
use crate::{new_sub_parser_from_file, Directory, DirectoryOwnership};
1+
use crate::new_sub_parser_from_file;
22

33
use rustc_ast::ast::{self, Attribute, Ident, Mod};
4-
use rustc_ast::attr;
5-
use rustc_ast::token;
4+
use rustc_ast::{attr, token};
65
use rustc_errors::{struct_span_err, PResult};
76
use rustc_session::parse::ParseSess;
87
use rustc_span::source_map::{FileName, Span};
98
use rustc_span::symbol::sym;
109

1110
use std::path::{self, Path, PathBuf};
1211

12+
#[derive(Clone)]
13+
pub struct Directory {
14+
pub path: PathBuf,
15+
pub ownership: DirectoryOwnership,
16+
}
17+
18+
#[derive(Copy, Clone)]
19+
pub enum DirectoryOwnership {
20+
Owned {
21+
// None if `mod.rs`, `Some("foo")` if we're in `foo.rs`.
22+
relative: Option<ast::Ident>,
23+
},
24+
UnownedViaBlock,
25+
UnownedViaMod,
26+
}
27+
1328
/// Information about the path to a module.
1429
// Public for rustfmt usage.
1530
pub struct ModulePath<'a> {

0 commit comments

Comments
 (0)