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

Name resolution 2.0 does not support use declarations coming before the item they reference #2935

Closed
CohenArthur opened this issue Mar 27, 2024 · 1 comment

Comments

@CohenArthur
Copy link
Member

use module::f;

pub mod module {
    pub fn f() {}
}

this should work, but running the compiler with -frust-name-resolution-2.0 produces this instead:

arthur@platypus ~/G/r/gccrs (master) [4]> build/gcc/crab1 test.rs -frust-name-resolution-2.0
test.rs:4:5: error: failed to resolve path segment ‘module[E0433]
    4 | use module::f;
      |     ^~~~~~
test.rs:4:5: error: failed to resolve path segment ‘module’ [E0433]
test.rs:4:5: error: failed to resolve path segment ‘module[E0433]
test.rs:4:13: error: unresolved import ‘module::f’ [E0433]
    4 | use module::f;
      |             ^
@P-E-P
Copy link
Member

P-E-P commented Feb 12, 2025

Fixed on master https://godbolt.org/z/6W9xj7aa6

@P-E-P P-E-P closed this as completed Feb 12, 2025
@github-project-automation github-project-automation bot moved this from Todo to Done in name resolution 2.0 Feb 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

No branches or pull requests

2 participants