Skip to content

Unresolved import in module located in function #116053

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

Closed
AndreySmirnov81 opened this issue Sep 22, 2023 · 2 comments
Closed

Unresolved import in module located in function #116053

AndreySmirnov81 opened this issue Sep 22, 2023 · 2 comments

Comments

@AndreySmirnov81
Copy link

mod m1 {
    struct T1;
    const C1: i32 = 123;

    fn foo() {
        struct T2;
        const C2: i32 = 123;

        mod m2 {
            use super::T1; // OK
            use super::T2; // error[E0432]: unresolved import `super::T2`

            use super::C1; // OK
            use super::C2; // error[E0432]: unresolved import `super::C2`
        }
    }
}

rustc 1.72.0

I think that T2 and C2 should be interpreted as located in the m1 module but limited by the scope of the foo function block.

@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Sep 22, 2023
@AndreySmirnov81 AndreySmirnov81 changed the title Unresolved import from module located in function Unresolved import in module located in function Sep 22, 2023
@bvanjoi
Copy link
Contributor

bvanjoi commented Sep 22, 2023

same as #79260

@saethlin
Copy link
Member

Closing as duplicate, if you disagree don't hesitate to say something.

@saethlin saethlin closed this as not planned Won't fix, can't repro, duplicate, stale Sep 22, 2023
@saethlin saethlin removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Sep 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants