mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-02 19:53:46 +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_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;
|
||||||
use rustc_parse::parser::Parser;
|
use rustc_parse::parser::Parser;
|
||||||
use rustc_parse::validate_attr;
|
use rustc_parse::validate_attr;
|
||||||
use rustc_parse::DirectoryOwnership;
|
use rustc_parse::DirectoryOwnership;
|
||||||
@ -1448,13 +1449,12 @@ impl<'a, 'b> MutVisitor for InvocationCollector<'a, 'b> {
|
|||||||
module.mod_path.push(item.ident);
|
module.mod_path.push(item.ident);
|
||||||
|
|
||||||
if inline {
|
if inline {
|
||||||
if let Some(path) = attr::first_attr_value_str_by_name(&item.attrs, sym::path) {
|
module::push_directory(
|
||||||
self.cx.current_expansion.directory_ownership =
|
item.ident,
|
||||||
DirectoryOwnership::Owned { relative: None };
|
&item.attrs,
|
||||||
module.directory.push(&*path.as_str());
|
&mut self.cx.current_expansion.directory_ownership,
|
||||||
} else {
|
&mut module.directory,
|
||||||
module.directory.push(&*item.ident.as_str());
|
);
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
let path = self.cx.parse_sess.source_map().span_to_unmapped_path(inner);
|
let path = self.cx.parse_sess.source_map().span_to_unmapped_path(inner);
|
||||||
let mut path = match path {
|
let mut path = match path {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
pub mod attr;
|
pub mod attr;
|
||||||
mod expr;
|
mod expr;
|
||||||
mod item;
|
mod item;
|
||||||
mod module;
|
pub mod module;
|
||||||
pub use module::{ModulePath, ModulePathSuccess};
|
pub use module::{ModulePath, ModulePathSuccess};
|
||||||
mod pat;
|
mod pat;
|
||||||
mod path;
|
mod path;
|
||||||
|
@ -133,7 +133,7 @@ fn eval_src_mod<'a>(
|
|||||||
Ok(module)
|
Ok(module)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn push_directory(
|
pub fn push_directory(
|
||||||
id: Ident,
|
id: Ident,
|
||||||
attrs: &[Attribute],
|
attrs: &[Attribute],
|
||||||
dir_ownership: &mut DirectoryOwnership,
|
dir_ownership: &mut DirectoryOwnership,
|
||||||
|
Loading…
Reference in New Issue
Block a user