mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-30 18:53:39 +00:00
expand: use push_directory
This commit is contained in:
parent
98e71cd5d7
commit
b9e1b26611
@ -18,6 +18,7 @@ use rustc_attr::{self as attr, is_builtin_attr, HasAttrs};
|
||||
use rustc_errors::{Applicability, FatalError, PResult};
|
||||
use rustc_feature::Features;
|
||||
use rustc_parse::configure;
|
||||
use rustc_parse::parser::module;
|
||||
use rustc_parse::parser::Parser;
|
||||
use rustc_parse::validate_attr;
|
||||
use rustc_parse::DirectoryOwnership;
|
||||
@ -1448,13 +1449,12 @@ impl<'a, 'b> MutVisitor for InvocationCollector<'a, 'b> {
|
||||
module.mod_path.push(item.ident);
|
||||
|
||||
if inline {
|
||||
if let Some(path) = attr::first_attr_value_str_by_name(&item.attrs, sym::path) {
|
||||
self.cx.current_expansion.directory_ownership =
|
||||
DirectoryOwnership::Owned { relative: None };
|
||||
module.directory.push(&*path.as_str());
|
||||
} else {
|
||||
module.directory.push(&*item.ident.as_str());
|
||||
}
|
||||
module::push_directory(
|
||||
item.ident,
|
||||
&item.attrs,
|
||||
&mut self.cx.current_expansion.directory_ownership,
|
||||
&mut module.directory,
|
||||
);
|
||||
} else {
|
||||
let path = self.cx.parse_sess.source_map().span_to_unmapped_path(inner);
|
||||
let mut path = match path {
|
||||
|
@ -1,7 +1,7 @@
|
||||
pub mod attr;
|
||||
mod expr;
|
||||
mod item;
|
||||
mod module;
|
||||
pub mod module;
|
||||
pub use module::{ModulePath, ModulePathSuccess};
|
||||
mod pat;
|
||||
mod path;
|
||||
|
@ -133,7 +133,7 @@ fn eval_src_mod<'a>(
|
||||
Ok(module)
|
||||
}
|
||||
|
||||
fn push_directory(
|
||||
pub fn push_directory(
|
||||
id: Ident,
|
||||
attrs: &[Attribute],
|
||||
dir_ownership: &mut DirectoryOwnership,
|
||||
|
Loading…
Reference in New Issue
Block a user