Skip to content

Commit 6561b71

Browse files
committed
fix: do not resolve prelude within block modules
1 parent 845754a commit 6561b71

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/tools/rust-analyzer/crates/hir-def/src/nameres/path_resolution.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,12 @@ impl DefMap {
493493
)
494494
})
495495
};
496-
let prelude = || self.resolve_in_prelude(db, name);
496+
let prelude = || {
497+
if self.block.is_some() && module == DefMap::ROOT {
498+
return PerNs::none();
499+
}
500+
self.resolve_in_prelude(db, name)
501+
};
497502

498503
from_legacy_macro
499504
.or(from_scope_or_builtin)

0 commit comments

Comments
 (0)