-
Notifications
You must be signed in to change notification settings - Fork 1.7k
[ERROR hir_ty::mir] Only tuple or closure has tuple or closure field #15090
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
Comments
I am currently working on a small demo project using Diesel and Axum. However, I am encountering some issues when trying to integrate Diesel. Specifically, rust-analyzer seems unable to resolve some Diesel names and lose track of the types. In addition, I am also seeing the following error: "[ERROR hir_ty::mir] Only tuple has tuple field". |
I have the same issue with |
I see the same issue working with Diesel and Actix, maybe it has something to do with all of those macros from Diesel? |
I can reproduce with the following
Note that Backtrace
Edit: In fact it can be reduced to just
|
Investigated a little bit. Here is a way to make a similar error:
Error: And this:
Error: In general, the error-handling in this block is off: rust-analyzer/crates/hir-ty/src/mir.rs Lines 154 to 227 in 2b7b44b
|
We might wanna set a flag for |
Here is another test case that, unlike the others, is actually valid code: struct Foo<T> {
l: T,
r: T,
}
trait Trait {
type State;
fn f(_: Self::State) -> Self;
}
impl<T> Trait for Foo<T> {
type State = (T, T);
fn f(state: Self::State) -> Self {
Self {
l: state.0,
r: state.1,
}
}
} It has trouble detecting that |
Aww man, that's totally why this slams I've been meaning to get up to speed on |
Hmm, fwiw this should only affect MIR building for the function so at worst you'll miss out on some diagnostics there. The simple fix would be to skip mir building if we encounter any sort of type mismatches as said here #15090 (comment) which shouldn't be too difficult. It's basically adding a bool field to |
I have the same issue. I edit
remove
panic backtrace:
rustc --version rust-analyzer --version |
Also mark InferenceResult::has_errors flag when there are error types Should work around #15090 (comment)
Also mark InferenceResult::has_errors flag when there are error types Should work around #15090 (comment)
Also mark InferenceResult::has_errors flag when there are error types Should work around rust-lang/rust-analyzer#15090 (comment)
I've found a more minimal reproduction. Going from |
I see this error too when running a diesel and axum project. Are there any workaround or fixes for this yet? This appears to be crashing rust analyzer a lot for me. It's getting really fustrating for me. |
@hkaiser25 This doesn't crash rust-analyzer unless you build from source, and there is a feature flag when building to not crash it. |
Which feature flag? Will adding this flag to the “cargo check” command that rust analyzer runs in the background fix the crashes for me? |
@hkaiser25 No, you need to set the feature flag when building rust-analyzer itself. If you install it from rust-analyzer/xtask/src/install.rs Line 140 in c588273
And remove |
@ChayimFriedman2 Can you advice on whether I should open a new issue to investigate whether this bug might be preventing |
@hkaiser25 you should file a new issue. |
Just created the issue with a reproducible example. #19543 |
While working on r-a itself I tend to see this spammed, I haven't figured out which part of the codebase causes this though
The text was updated successfully, but these errors were encountered: