Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Properly resolve prelude paths inside modules inside blocks #18422

Merged
merged 1 commit into from
Oct 28, 2024

Commits on Oct 27, 2024

  1. 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 rust-lang#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.
    ChayimFriedman2 committed Oct 27, 2024
    Configuration menu
    Copy the full SHA
    1fed240 View commit details
    Browse the repository at this point in the history