rust-lang / rust-lang/rust-analyzer
Cargo check fails due to error: 'Only tuple has tuple field'
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
rust-analyzer version: rust-analyzer version: 0.3.2370-standalone (588948f267 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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the failure with Cargo.toml, lib.rs, schema.rs, and models.rs using the Diesel dependency and the shown Post definition. Start by running cargo check through rust-analyzer with one Post field removed, then trace the repeated “Only tuple has tuple field” errors. Done means cargo check continues to run and new compiler diagnostics appear in the editor without the internal error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- developer-experience, devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100