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

Test function imports replaced by module imports. #18464

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rwakulszowa
Copy link

Test for #18347.
The issue affects all code using import merging. When a function and a module share the same identifier, e.g.

pub fn foo() {}
pub mod foo { pub fn bar() {} }

rust analyzer often confuses the function with the module, generating invalid code.

Test for rust-lang#18347.
The issue affects all code using import merging. When a function and a
module share the same identifier, e.g.

```rust
pub fn foo() {}
pub mod foo { pub fn bar() {} }
```

rust analyzer often confuses the function with the module, generating
invalid code.
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 2, 2024
@rwakulszowa
Copy link
Author

I haven't been able to actually find a proper fix yet. I can't find a reliable way to tell the merging function whether an import is a module (and can be used for merging) or a function.

I'm not sure if I manage to find a solution, so I'm sending a small PR with what I have.

@Veykril
Copy link
Member

Veykril commented Dec 9, 2024

The IDE layer currently lacks being able to resolve something to multiple namespaces (Semantics::resolve_path only yields one namespace at most), so that needs tackling first and is unfortunately a bigger change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants