Skip to content

Cargo check fails due to error: 'Only tuple has tuple field' #19543

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

Open
hkaiser25 opened this issue Apr 8, 2025 · 5 comments
Open

Cargo check fails due to error: 'Only tuple has tuple field' #19543

hkaiser25 opened this issue Apr 8, 2025 · 5 comments
Labels
C-bug Category: bug

Comments

@hkaiser25
Copy link

hkaiser25 commented Apr 8, 2025

rust-analyzer version: rust-analyzer version: 0.3.2370-standalone (588948f 2025-04-06)

rustc version: rustc 1.84.1 (e71f9a9a9 2025-01-27)

editor or extension: VSCode extension version 0.3.2370

code snippet to reproduce:
Cargo.toml

[dependencies]
diesel = { version = "2.2.9", features = ["postgres"] }

lib.rs

pub mod models;
pub mod schema;

schema.rs

diesel::table! {
    posts (id) {
        id -> Int4,
        title -> Varchar,
        body -> Text,
        published -> Bool,
    }
}

models.rs

use diesel::prelude::*;

#[derive(Queryable, Selectable)]
#[diesel(table_name = crate::schema::posts)]
#[diesel(check_for_backend(diesel::pg::Pg))]
pub struct Post {
    pub id: i32,
    pub title: String,
    pub body: String,
    pub published: bool,
}

Remove or comment out one of the fields in the Post struct. RA reports the same error multiple times in the 'Output' pane in VSCode:

2025-04-08T13:22:00.836701386Z ERROR Only tuple has tuple field: AssocTypeId(Id(121f8))<[?0 := AdtId(StructId(StructId(814e)))<[]>, ?1 := 3<[?0 := !0_405509, ?1 := !0_405510, ?2 := !0_405511]>, ?2 := !0_405508]>
2025-04-08T13:22:00.836755017Z ERROR Only tuple has tuple field: AssocTypeId(Id(121f8))<[?0 := AdtId(StructId(StructId(814e)))<[]>, ?1 := 3<[?0 := !0_405509, ?1 := !0_405510, ?2 := !0_405511]>, ?2 := !0_405508]>
2025-04-08T13:22:00.836777935Z ERROR Only tuple has tuple field: AssocTypeId(Id(121f8))<[?0 := AdtId(StructId(StructId(814e)))<[]>, ?1 := 3<[?0 := !0_405509, ?1 := !0_405510, ?2 := !0_405511]>, ?2 := !0_405508]>
2025-04-08T13:22:00.836798345Z ERROR Only tuple has tuple field: AssocTypeId(Id(121f8))<[?0 := AdtId(StructId(StructId(814e)))<[]>, ?1 := 3<[?0 := !0_405509, ?1 := !0_405510, ?2 := !0_405511]>, ?2 := !0_405508]>
2025-04-08T13:22:00.839999462Z ERROR Only tuple has tuple field: AssocTypeId(Id(121f8))<[?0 := AdtId(StructId(StructId(814e)))<[]>, ?1 := 3<[?0 := !0_405509, ?1 := !0_405510, ?2 := !0_405511]>, ?2 := !0_405508]>
2025-04-08T13:22:00.840047545Z ERROR Only tuple has tuple field: AssocTypeId(Id(121f8))<[?0 := AdtId(StructId(StructId(814e)))<[]>, ?1 := 3<[?0 := !0_405509, ?1 := !0_405510, ?2 := !0_405511]>, ?2 := !0_405508]>

Then whenever I try to save the file, cargo check fails to run and no more new compile time errors/warnings get displayed in the text editor. Other features of RA work such as completions and syntax error detection.

@ChayimFriedman2
Copy link
Contributor

Are you sure it's related to the logged error? I can't see how that'll impact that.

@hkaiser25
Copy link
Author

Are you sure it's related to the logged error? I can't see how that'll impact that.

Were you able to reproduce the bug, and did it affect cargo check in RA on your end? I can’t say with certainty that this logged error is directly causing cargo check to fail, but I’m simply reporting what I’ve observed when the error occurs. Let me know if there's anything else I can provide to help.

@hkaiser25
Copy link
Author

@ChayimFriedman2 Sorry for pinging you, but I was wondering if you have any update on whether you were able to reproduce this bug? Thank you!

@ChayimFriedman2
Copy link
Contributor

Sorry, I didn't find the time for this. Now I tried it and couldn't reproduce. I did have a lot of "Only tuple has tuple field" logs (which as I said, shouldn't impact development), but check on save works normally.

@hkaiser25
Copy link
Author

Ok thanks for confirming that it's not related to the error in the logs. I'm not sure what could be breaking cargo check save feature. Other people have reported this issue too btw. Do you have any suggestions on next steps for troubleshooting this problem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug
Projects
None yet
Development

No branches or pull requests

2 participants