Skip to content

Commit b9e1b26

Browse files
committed
expand: use push_directory
1 parent 98e71cd commit b9e1b26

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

src/librustc_expand/expand.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ 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;
2122
use rustc_parse::parser::Parser;
2223
use rustc_parse::validate_attr;
2324
use rustc_parse::DirectoryOwnership;
@@ -1448,13 +1449,12 @@ impl<'a, 'b> MutVisitor for InvocationCollector<'a, 'b> {
14481449
module.mod_path.push(item.ident);
14491450

14501451
if inline {
1451-
if let Some(path) = attr::first_attr_value_str_by_name(&item.attrs, sym::path) {
1452-
self.cx.current_expansion.directory_ownership =
1453-
DirectoryOwnership::Owned { relative: None };
1454-
module.directory.push(&*path.as_str());
1455-
} else {
1456-
module.directory.push(&*item.ident.as_str());
1457-
}
1452+
module::push_directory(
1453+
item.ident,
1454+
&item.attrs,
1455+
&mut self.cx.current_expansion.directory_ownership,
1456+
&mut module.directory,
1457+
);
14581458
} else {
14591459
let path = self.cx.parse_sess.source_map().span_to_unmapped_path(inner);
14601460
let mut path = match path {

src/librustc_parse/parser/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
pub mod attr;
22
mod expr;
33
mod item;
4-
mod module;
4+
pub mod module;
55
pub use module::{ModulePath, ModulePathSuccess};
66
mod pat;
77
mod path;

src/librustc_parse/parser/module.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ fn eval_src_mod<'a>(
133133
Ok(module)
134134
}
135135

136-
fn push_directory(
136+
pub fn push_directory(
137137
id: Ident,
138138
attrs: &[Attribute],
139139
dir_ownership: &mut DirectoryOwnership,

0 commit comments

Comments
 (0)