This commit is contained in:
Ryo Yoshida 2023-05-11 15:55:41 +09:00
parent a4966c9282
commit a0a7860141
No known key found for this signature in database
GPG key ID: E25698A930586171
2 changed files with 78 additions and 75 deletions

View file

@ -289,7 +289,12 @@ impl DefCollector<'_> {
let module_id = self.def_map.root;
let attrs = item_tree.top_level_attrs(self.db, self.def_map.krate);
if attrs.cfg().map_or(true, |cfg| self.cfg_options.check(&cfg) != Some(false)) {
if let Some(cfg) = attrs.cfg() {
if self.cfg_options.check(&cfg) == Some(false) {
return;
}
}
self.inject_prelude(&attrs);
// Process other crate-level attributes.
@ -363,7 +368,6 @@ impl DefCollector<'_> {
}
.collect_in_top_module(item_tree.top_level_items());
}
}
fn seed_with_inner(&mut self, tree_id: TreeId) {
let item_tree = tree_id.item_tree(self.db);

View file

@ -4,7 +4,6 @@ use hir_def::{
attr::{AttrsWithOwner, Documentation},
item_scope::ItemInNs,
path::ModPath,
per_ns::PerNs,
resolver::HasResolver,
AttrDefId, GenericParamId, ModuleDefId,
};
@ -155,14 +154,14 @@ fn resolve_doc_path(
.syntax_node()
.descendants()
.find_map(ast::Path::cast)?;
if ast_path.to_string() != link {
if ast_path.syntax().text() != link {
return None;
}
ModPath::from_src(db.upcast(), ast_path, &Hygiene::new_unhygienic())?
};
let resolved = resolver.resolve_module_path_in_items(db.upcast(), &modpath);
let resolved = if resolved == PerNs::none() {
let resolved = if resolved.is_none() {
resolver.resolve_module_path_in_trait_assoc_items(db.upcast(), &modpath)?
} else {
resolved