rust-analyzer/crates/ide-diagnostics
Chayim Refael Friedman 1fed2403d1 Properly resolve prelude paths inside modules inside blocks
I.e. the following situation:
```
fn foo() {
    mod bar {
        fn qux() {
            // Prelude path here (e.g. macro use prelude or extern prelude).
        }
    }
}
```
Those were previously unresolved, because, in order to support `self` and `super` properly, since #15148 we do not ascend block paths when there is a module in between, but only crate def maps register preludes, not block def maps, and we can't change this because block def map prelude can always be overridden by another block. E.g.
```
fn foo() {
    struct WithTheSameNameAsPreludeItem;
    {
        WithTheSameNameAsPreludeItem
    }
}
```
Here `WithTheSameNameAsPreludeItem` refer to the item from the top block, but if we would register prelude items in each block the child block would overwrite it incorrectly.
2024-10-27 19:23:12 +02:00
..
src Properly resolve prelude paths inside modules inside blocks 2024-10-27 19:23:12 +02:00
Cargo.toml Replace once_cell with std's recently stabilized OnceCell/Lock and LazyCell/Lock 2024-08-16 09:53:37 +03:00