Skip to content

Cannot inference certain type. #2984

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
crlf0710 opened this issue Feb 2, 2020 · 4 comments · Fixed by #9128
Closed

Cannot inference certain type. #2984

crlf0710 opened this issue Feb 2, 2020 · 4 comments · Fixed by #9128
Labels
A-macro macro expansion A-ty type system / type inference / traits / method resolution S-unactionable Issue requires feedback, design decisions or is blocked on other work

Comments

@crlf0710
Copy link
Member

crlf0710 commented Feb 2, 2020

Repro repo:
https://github.com/crlf0710/ra_bug_repo

rustc is able to inference the type of variable _struct_data, while ra only shows "{unknown}".

@flodiebold
Copy link
Member

The syn::DataStruct type is generated by a macro; I assume there's something in there we can't handle. I haven't checked in detail though.

@kiljacken
Copy link
Contributor

My short analysis is that we can't resolve into_data_struct() because it is generated by a procedural macro easy_ext::ext. We don't currently support proc macros.

@flodiebold
Copy link
Member

flodiebold commented Feb 2, 2020

I don't think that's the problem, since we ignore attribute macros completely, so this just looks like a normal impl. (Same goes e.g. for the salsa stuff in RA itself.)

@lnicola lnicola added A-macro macro expansion S-actionable Someone could pick this issue up and work on it right now A-ty type system / type inference / traits / method resolution labels Dec 21, 2020
@jonas-schievink
Copy link
Contributor

The impl syn::Data doesn't work here, because the crate isn't the one defining syn::Data. That means this is just #6029 – it would work if we expanded the attribute macro.

@lnicola lnicola added S-unactionable Issue requires feedback, design decisions or is blocked on other work and removed S-actionable Someone could pick this issue up and work on it right now labels Mar 19, 2021
bors bot added a commit that referenced this issue Jun 3, 2021
9128: feat: expand procedural attribute macros r=jonas-schievink a=jonas-schievink

This adds experimental support for attribute macros. They can be enabled by setting `rust-analyzer.experimental.procAttrMacros` to `true`.

Known issues:
* Tokens aren't remapped, presumably because we edit the input syntax tree (this causes IDE features to not work inside items with attribute macros on them)
* Macro errors aren't reported correctly

Closes #8971
Fixes #8964 / la10736/rstest#120
Fixes #2984
Fixes #5412
Fixes #6029
Fixes #6687

#6740 is still not fixed – we now expand `#[proc_macro_hack]`, but fail to expand the resulting `proc_macro_call!()` macro.

Co-authored-by: Jonas Schievink <[email protected]>
@bors bors bot closed this as completed in 1415367 Jun 3, 2021
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 S-unactionable Issue requires feedback, design decisions or is blocked on other work
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants