- let root_filename: PathBuf = codemap.span_to_filename(krate.span).into();
- list_submodules(&krate.module,
- root_filename.parent().unwrap(),
- codemap,
- &mut result);
- result.insert(root_filename, &krate.module);
- result
+ let root_filename = source_map.span_to_filename(krate.span);
+ {
+ let parent = match root_filename {
+ source_map::FileName::Real(ref path) => path.parent().unwrap(),
+ _ => Path::new(""),
+ };
+ list_submodules(&krate.module, parent, None, source_map, &mut result)?;
+ }
+ result.insert(root_filename.into(), &krate.module);
+ Ok(result)
+}
+
+fn path_value(attr: &ast::Attribute) -> Option<Symbol> {
+ if attr.name() == "path" {
+ attr.value_str()
+ } else {
+ None
+ }
+}
+
+// N.B. Even when there are multiple `#[path = ...]` attributes, we just need to
+// examine the first one, since rustc ignores the second and the subsequent ones
+// as unused attributes.
+fn find_path_value(attrs: &[ast::Attribute]) -> Option<Symbol> {
+ attrs.iter().flat_map(path_value).next()