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

rust-analyzer unable to see some types in zbus::fdo #18138

Open
Veykril opened this issue Sep 18, 2024 · 15 comments
Open

rust-analyzer unable to see some types in zbus::fdo #18138

Veykril opened this issue Sep 18, 2024 · 15 comments
Assignees
Labels
A-macro macro expansion A-ty type system / type inference / traits / method resolution C-bug Category: bug

Comments

@Veykril
Copy link
Member

Veykril commented Sep 18, 2024

dbus2/zbus#671

@Veykril Veykril added A-macro macro expansion A-ty type system / type inference / traits / method resolution C-bug Category: bug labels Sep 18, 2024
@ChayimFriedman2
Copy link
Contributor

Can't reproduce. Things are working fine to me (I didn't check on the linked commit but on HEAD).

@Veykril
Copy link
Member Author

Veykril commented Sep 18, 2024

Looks like I linked a fork by accident

@zeenix
Copy link

zeenix commented Sep 18, 2024

Can't reproduce. Things are working fine to me (I didn't check on the linked commit but on HEAD).

That actually part of the reproducer: i-e when using zbus prior to 4.0^ it worked fine.

^: Precisely pinpointing the exact commit that introduced this issue would a bit difficult since it'll require a long git bisect session with no automated reproducer combined with API breakages along the way.

@ChayimFriedman2
Copy link
Contributor

That actually part of the reproducer: i-e when using zbus prior to 4.0^ it worked fine.

Prior to, or after? Because I checked on HEAD, which should have the latest updates.

@Veykril
Copy link
Member Author

Veykril commented Sep 18, 2024

Would be nice if you could link a revision that exhibits the problem then

@zeenix
Copy link

zeenix commented Sep 18, 2024

Because I checked on HEAD, which should have the latest updates.

The latest HEAD of the corrected repo link main, or the main on my personal fork that @Veykril first linked by accident? The latter seems stuck on prior to 4.0 so you should not be able to reproduce there but with former you should be able to reproduce.

@zeenix
Copy link

zeenix commented Sep 18, 2024

Would be nice if you could link a revision that exhibits the problem then

The latest main and also latest crates.io release.

@ChayimFriedman2
Copy link
Contributor

Because I checked on HEAD, which should have the latest updates.

The latest HEAD of the corrected repo link main, or the main on my personal fork that @Veykril first linked by accident? The latter seems stuck on prior to 4.0 so you should not be able to reproduce there but with former you should be able to reproduce.

The HEAD of the correct repo, not the fork.

@zeenix
Copy link

zeenix commented Sep 18, 2024

Because I checked on HEAD, which should have the latest updates.

The latest HEAD of the corrected repo link main, or the main on my personal fork that @Veykril first linked by accident? The latter seems stuck on prior to 4.0 so you should not be able to reproduce there but with former you should be able to reproduce.

The HEAD of the correct repo, not the fork.

Oh, that's very strange. Just to be sure a recent refactor in zbus didn't end up somehow "fixing" this, I created a new project here and as you can see in the attached screencast, auto-completion doesn't work for the method of the generated DBusProxy type, even though I'm using the latest HEAD as well (the Cargo.toml is visible in the beginning of the video).

Screencast.from.2024-09-18.22-30-52.mp4

@Veykril
Copy link
Member Author

Veykril commented Sep 19, 2024

Can reproduce that, funny how we give the completion for DBusProxy but we aren't actually able to resolve it. The #[proxy] attribute fails to expand on the DBus trait for some reason but only when its used in the dependency

@ChayimFriedman2
Copy link
Contributor

Ok, with DBusProxy I can reproduce (but not with the types from the original issue).

@zeenix
Copy link

zeenix commented Sep 19, 2024

Can reproduce that, funny how we give the completion for DBusProxy but we aren't actually able to resolve it. The #[proxy] attribute fails to expand on the DBus trait for some reason but only when its used in the dependency

Just a shot in the dark but is it possible that proxy macro eating away its input trait (dbus2/zbus#225), causes this somehow? 🤔 Although that's always been the case so it's unlikely.

@ChayimFriedman2
Copy link
Contributor

If it expands to something, rust-analyzer should be able to see that something. It eating its input should not matter.

@ChayimFriedman2
Copy link
Contributor

@rustbot claim

@ChayimFriedman2
Copy link
Contributor

ChayimFriedman2 commented Sep 19, 2024

This is probably the same issue as #17630. This also has to do with a module shadowing the macro, and here too if I move the reexport of proxy at the crate root above the module declaration things start working correctly.

The issue is quite subtle: IDE features (e.g. goto def) do work correctly, but name resolving in the DefMap do not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-macro macro expansion A-ty type system / type inference / traits / method resolution C-bug Category: bug
Projects
None yet
Development

No branches or pull requests

3 participants