mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-02 06:41:48 +00:00
Auto merge of #17352 - roife:fix-issue-17338, r=Veykril
fix: do not resolve prelude within block modules fix #17338 (continuing from #17251). In #17251, we injected preludes into non-top-level modules, which leading to r-a to directly resolve names in preludes in block modules. This PR fix it by checking whether the module is a pseudo-module introduced by blocks. (similar to what we do for extern preludes)
This commit is contained in:
commit
af488c971f
2 changed files with 30 additions and 1 deletions
|
@ -493,7 +493,12 @@ impl DefMap {
|
|||
)
|
||||
})
|
||||
};
|
||||
let prelude = || self.resolve_in_prelude(db, name);
|
||||
let prelude = || {
|
||||
if self.block.is_some() && module == DefMap::ROOT {
|
||||
return PerNs::none();
|
||||
}
|
||||
self.resolve_in_prelude(db, name)
|
||||
};
|
||||
|
||||
from_legacy_macro
|
||||
.or(from_scope_or_builtin)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue