-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Methods provided via Deref<Target> are not being found #13238
Comments
This used to work for us, and now we've been seeing this for the last few weeks at least. |
And to use all types from the same file:
Using the methods from the |
So this only happens in this big project of yours? |
It's where I see it. It's both:
We've had some issues in the past where we needed to do things like increase chalk's overflow limits to stop things from breaking. I don't have a good sense of how to go about seeing if that's an issue (turning on any logging at all becomes a massive flood due to the number of crates involved). If you give some guidance on what tracing to turn on, I can see if this is something like chalk giving up on the resolution of the types. |
Bisected to 2c2520f |
Which is the sysroot support for project_json workspaces PR: |
edit: this was a red herring, the actual problem was me not realizing I needed to write Self::Bar and not just Bar |
👍 This issue comes up quite often for me due to many useful methods being implemented on the Deref type.
Most notably, those unrecognized methods break autocomplete, Go To Definition and type inference. |
@kangalioo are you working in the same project as @woody77, or a similar large project using rust-project.json? |
While @tbodt did run down a red-herring, while talking with him about it Friday I confirmed that specifying a
This changed in: https://github.com/rust-lang/rust-analyzer/pull/12858/files#diff-53e4b6b2c1ff2465d8abd50db160753199426fd788ddcad925752e0838e28de2R233 Before, if And now there are two sets of sysroot packages found in the deps of every crate, it seems? How to best model this for RA in a cross-compiling, multi-architecture build like we (Fuchsia) have is unclear. RA today doesn't handle different configurations of crates, but we compile many for both host and target (often both different in OS and Arch: I can remove the code that adds the sysroot crates (from the class in GN that produces our |
I am a bit confused, are you saying you are no longer specifying the |
No, we've never specified When we started specifying This happens at: rust-analyzer/crates/project-model/src/workspace.rs Lines 269 to 274 in 53b6d69
|
Hmm, so why are you now specifying |
We’re now specifying the sysroot because of the proc_macro_srv. That’s the
only reason we added it.
On Tue, Oct 25, 2022 at 4:49 AM Lukas Wirth ***@***.***> wrote:
Hmm, so why are you now specifying sysroot when you are still managing
the crates manually for it?
—
Reply to this email directly, view it on GitHub
<#13238 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AEFLWQCQXH6UJYZOPLQLJATWE7CKZANCNFSM6AAAAAAQN3SJHY>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
--
- Sent from my iPhone.
|
Right, unfortunately the way things are written atm we either expect a sysroot fully or we expect none. Changing things is a bit more involved and I'd need to do some digging to see if there is a feasible way to change stuff to not error out when certain parts are missing (by choice). Nevertheless it would be probably beneficial for you to look into supporting the sysroot via the correct fields instead of adding them manually if possible. |
I'm also (in my "spare time") looking at seeing what the impact is of not including the sysroot crates in our generated |
r-a should add the proc-macro crate to everything as a dependency (because every crate type, even non proc-macro ones have it as a dependency in rust) |
I've got a PR up for our rust-project.json generation, which removes the explicit addition of the sysroot crates, and lets rust-analyzer infer it from the |
The CL has landed, and our next GN roll should pick it up and fix this for our developers. Thanks for all the debugging help! |
It seems this issue still exists occasionally at least for |
@zhiqiangxu probably not the same issue. |
rust-analyzer version: (eg. output of "rust-analyzer: Show RA Version" command, accessible in VSCode via Ctrl/⌘+Shift+P)
rustc version:
rust-analyzer version: 0.4.1202-standalone
rustc 1.65.0-nightly (350cca3b6 2022-08-30)
relevant settings: VSCode remote, with a very large project (1000s of crates), no extra env settings for CHALK
Methods from
OtherType
that are defined for a type (ThisType
) via implementingDeref<Target=OtherType>
are not being found as valid symbols, and flagged asunresolvedReference
.Using the following struct:
The following do not resolve

.chars()
:But the following do resolve

chars()
correctly:Full source (and proof that these work) at:
https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=d5c1d59fa47c1228df2be80042ec41a1
The text was updated successfully, but these errors were encountered: