-
-
Notifications
You must be signed in to change notification settings - Fork 34
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 compatibility #319
Comments
As said in #320, the rust-analyzer team seems to be starting to work on support for attribute proc-macros (rust-lang/rust-analyzer#8486), so I would prefer to wait for it instead of adding the API on the pin-project side for now. |
rust-analyzer added experimental support for attribute macros: rust-lang/rust-analyzer#9128 |
This should also work now |
Issue rust-lang/rust-analyzer#6029 has been closed - is there anything left to do here? |
Doesn't seem to be working for me.. on https://gist.github.com/teozkr/0971d3f7d7ce0369861f167287bc5de0, Rust-Analyzer has no idea about either I haven't had the time yet to investigate which piece is still missing. |
Curiously, it seems to work fine in VSCode, while Emacs completely ignores the proc macro and everything it generates. So maybe this is actually just a problem with how lsp-mode configures rust-analyzer now? |
Yeah, apparently I had screwed up enabling proc attr macro support in my RA. After fixing that pin-project worked just fine! So it looks like this issue can finally be closed, then. |
Currently, pin-project's macros aren't expanded by Rust-Analyzer, which prevents things like auto-completing into projections. This is due to pin-project using a bunch of features that Rust-Analyzer still doesn't understand. However, it doesn't look like any of these are ultimately fundamental to the way pin-project works.
#[pin_project]
can be kept as a compatibility wrapper, so no breakage is required here)const _: () = { struct __FooProjection {} };
)#[pin(project = FooProj)]
) are already placed in the regular outer scopeconst _: () = { impl Foo {} };
fn project()
impl in the regular outer scope if the projection type is renamed (and the same forfn project_ref()
)let foo: Foo<T>; foo.project()
is inferred asFooProj<{unknown}>
, Method calls with custom receiver types "forget" their type arguments rust-lang/rust-analyzer#8100)let foo: Foo<T>; Foo::project(foo)
is inferred correctly asFooProj<T>
)#[pin_project]
#[pin_project]
or#[derive(PinProject)]
within a single moduleThe text was updated successfully, but these errors were encountered: