Skip to content

Diagnostics show long untruncated type #161439

Closed

Description

@weiznich

Code

extern crate diesel; // diesel = { version = "2.3", features = ["sqlite"] }

use diesel::*;

table! {
    users {
        id -> Integer,
    }
}

fn main() {
    use self::users::dsl::*;

    users.for_update().distinct();
}

Current output

Checking testing v0.1.0 (/tmp/testing)
error[E0277]: the trait bound `SelectStatement<..., ..., ..., ..., ..., ..., ..., ..., ...>: DistinctDsl` is not satisfied
   --> src/main.rs:14:24
    |
 14 |     users.for_update().distinct();
    |                        ^^^^^^^^ the trait `DistinctDsl` is not implemented for `SelectStatement<..., ..., ..., ..., ..., ..., ..., ..., ...>`
    |
    = note: a `DISTINCT` clause is not compatible with various other clauses like `LOCKING` clauses
help: the trait `DistinctDsl` is implemented for `diesel::query_builder::select_statement::SelectStatement<F, S, D, W, O, LOf, G, H>`
   --> /home/weiznich/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/diesel-2.3.12/src/query_builder/select_statement/dsl_impls.rs:179:1
    |
179 | / impl<ST, F, S, D, W, O, LOf, G, H> DistinctDsl for SelectStatement<F, S, D, W, O, LOf, G, H>
180 | | where
181 | |     Self: SelectQuery<SqlType = ST>,
182 | |     SelectStatement<F, S, DistinctClause, W, O, LOf, G, H>: SelectQuery<SqlType = ST>,
    | |______________________________________________________________________________________^
    = note: the full name for the type has been written to '/tmp/testing/target/debug/deps/testing-03118f16a731a39e.long-type-12300597481247196782.txt'
    = note: consider using `--verbose` to print the full type name to the console

error[E0277]: the trait bound `SelectStatement<..., ..., ..., ..., ..., ..., ..., ..., ...>: Table` is not satisfied
   --> src/main.rs:14:24
    |
 14 |     users.for_update().distinct();
    |                        ^^^^^^^^ the trait `DistinctDsl` is not implemented for `SelectStatement<..., ..., ..., ..., ..., ..., ..., ..., ...>`
    |
help: the trait `DistinctDsl` is implemented for `diesel::query_builder::select_statement::SelectStatement<F, S, D, W, O, LOf, G, H>`
   --> /home/weiznich/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/diesel-2.3.12/src/query_builder/select_statement/dsl_impls.rs:179:1
    |
179 | / impl<ST, F, S, D, W, O, LOf, G, H> DistinctDsl for SelectStatement<F, S, D, W, O, LOf, G, H>
180 | | where
181 | |     Self: SelectQuery<SqlType = ST>,
182 | |     SelectStatement<F, S, DistinctClause, W, O, LOf, G, H>: SelectQuery<SqlType = ST>,
    | |______________________________________________________________________________________^
    = note: the full name for the type has been written to '/tmp/testing/target/debug/deps/testing-03118f16a731a39e.long-type-12300597481247196782.txt'
    = note: consider using `--verbose` to print the full type name to the console

error[E0277]: the trait bound `SelectStatement<FromClause<...>>: DistinctDsl` is not satisfied
   --> src/main.rs:14:24
    |
 14 |     users.for_update().distinct();
    |                        ^^^^^^^^ the trait `DistinctDsl` is not implemented for `SelectStatement<FromClause<...>>`
    |
    = note: a `DISTINCT` clause is not compatible with various other clauses like `LOCKING` clauses
help: the trait `DistinctDsl` is conditionally implemented for `diesel::query_builder::select_statement::SelectStatement<F, S, D, W, O, LOf, G, H>`
   --> /home/weiznich/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/diesel-2.3.12/src/query_builder/select_statement/dsl_impls.rs:179:1
    |
179 |   impl<ST, F, S, D, W, O, LOf, G, H> DistinctDsl for SelectStatement<F, S, D, W, O, LOf, G, H>
    |   ^           - unsatisfied requirement introduced here: `diesel::query_builder::select_clause::DefaultSelectClause<diesel::query_builder::from_clause::FromClause<diesel::query_builder::select_statement::SelectStatement<diesel::query_builder::from_clause::FromClause<users::table>, diesel::query_builder::select_clause::DefaultSelectClause<diesel::query_builder::from_clause::FromClause<users::table>>, diesel::query_builder::distinct_clause::NoDistinctClause, diesel::query_builder::where_clause::NoWhereClause, diesel::query_builder::order_clause::NoOrderClause, diesel::query_builder::limit_offset_clause::LimitOffsetClause<diesel::query_builder::limit_clause::NoLimitClause, diesel::query_builder::offset_clause::NoOffsetClause>, diesel::query_builder::group_by_clause::NoGroupByClause, diesel::query_builder::having_clause::NoHavingClause, diesel::query_builder::locking_clause::LockingClause>>>: Sized`
    |  _|
    | |
180 | | where
181 | |     Self: SelectQuery<SqlType = ST>,
    | |                       ------------ unsatisfied requirement introduced here: `<diesel::query_builder::select_statement::SelectStatement<diesel::query_builder::from_clause::FromClause<diesel::query_builder::select_statement::SelectStatement<diesel::query_builder::from_clause::FromClause<users::table>, diesel::query_builder::select_clause::DefaultSelectClause<diesel::query_builder::from_clause::FromClause<users::table>>, diesel::query_builder::distinct_clause::NoDistinctClause, diesel::query_builder::where_clause::NoWhereClause, diesel::query_builder::order_clause::NoOrderClause, diesel::query_builder::limit_offset_clause::LimitOffsetClause<diesel::query_builder::limit_clause::NoLimitClause, diesel::query_builder::offset_clause::NoOffsetClause>, diesel::query_builder::group_by_clause::NoGroupByClause, diesel::query_builder::having_clause::NoHavingClause, diesel::query_builder::locking_clause::LockingClause>>> as SelectQuery>::SqlType == _`
182 | |     SelectStatement<F, S, DistinctClause, W, O, LOf, G, H>: SelectQuery<SqlType = ST>,
    | |______________________________________________________________________________________^
    = note: the full name for the type has been written to '/tmp/testing/target/debug/deps/testing-03118f16a731a39e.long-type-15337691006018164503.txt'
    = note: consider using `--verbose` to print the full type name to the console

For more information about this error, try `rustc --explain E0277`.
error: could not compile `testing` (bin "testing") due to 3 previous errors

rust-compilation exited abnormally with code 101 at Fri Aug 21 08:50:53, duration 0.08 s

Desired output

unsatisfied requirement introduced here: `<diesel::query_builder::select_statement::SelectStatement<diesel::query_builder::from_clause::FromClause<diesel::query_builder::select_statement::SelectStatement<diesel::query_builder::from_clause::FromClause<users::table>, diesel::query_builder::select_clause::DefaultSelectClause<diesel::query_builder::from_clause::FromClause<users::table>>, diesel::query_builder::distinct_clause::NoDistinctClause, diesel::query_builder::where_clause::NoWhereClause, diesel::query_builder::order_clause::NoOrderClause, diesel::query_builder::limit_offset_clause::LimitOffsetClause<diesel::query_builder::limit_clause::NoLimitClause, diesel::query_builder::offset_clause::NoOffsetClause>, diesel::query_builder::group_by_clause::NoGroupByClause, diesel::query_builder::having_clause::NoHavingClause, diesel::query_builder::locking_clause::LockingClause>>> as SelectQuery>::SqlType == _`

should be shorted to whatever rustc performs in other places

Rationale and extra context

Types are truncated in all other contexts in the error messages

Other cases

Rust Version

rustc 1.98.0 (88d9e12ae 2026-08-18)
binary: rustc
commit-hash: 88d9e12ae178fab0fb5cc050a94da85685d449ea
commit-date: 2026-08-18
host: x86_64-unknown-linux-gnu
release: 1.98.0
LLVM version: 22.1.8

Anything else?

This started to appear with rust 1.98. 1.97 does not have this long type, so it's a recent change

Activity

  1. added
    A-diagnosticsArea: Messages for errors, warnings, and lints
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    on Aug 21, 2026
  2. added
    D-papercutDiagnostics: An error or lint that needs small tweaks.
    D-verboseDiagnostics: Too much output caused by a single piece of incorrect code.
    and removed
    D-papercutDiagnostics: An error or lint that needs small tweaks.
    on Aug 21, 2026
  3. lsunsi commented on Aug 24, 2026

    @lsunsi
    Contributor

    @rustbot claim

    I'll start by bisecting since @weiznich said it's a recent change.
    If anyone has more pointers on where to look or something, please let me know!

  4. lsunsi commented on Aug 25, 2026

    @lsunsi
    Contributor

    It seems this was introduced in 752cc4a (found via bisect). Investigating further

  5. lsunsi commented on Aug 26, 2026

    @lsunsi
    Contributor

    @weiznich The output coming from your code using #161818 is as follows.

    info: `cargo` is unavailable for the active toolchain
    info: falling back to "/home/lsunsi/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/cargo"
        Checking issue161439 v0.1.0 (/home/lsunsi/Documents/issue161439)
    error[E0277]: the trait bound `SelectStatement<FromClause<table>, DefaultSelectClause<_>, _, _, _, _, _, _, _>: DistinctDsl` is not satisfied
       --> src/main.rs:13:24
        |
     13 |     users.for_update().distinct();
        |                        ^^^^^^^^ the trait `DistinctDsl` is not implemented for `SelectStatement<FromClause<table>, DefaultSelectClause<FromClause<table>>, _, _, _, _, _, _, _>`
        |
        = note: a `DISTINCT` clause is not compatible with various other clauses like `LOCKING` clauses
    help: the trait `DistinctDsl` is implemented for `diesel::internal::table_macro::SelectStatement<F, S, D, W, O, LOf, G, H>`
       --> /home/lsunsi/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/diesel-2.3.12/src/query_builder/select_statement/dsl_impls.rs:179:1
        |
    179 | / impl<ST, F, S, D, W, O, LOf, G, H> DistinctDsl for SelectStatement<F, S, D, W, O, LOf, G, H>
    180 | | where
    181 | |     Self: SelectQuery<SqlType = ST>,
    182 | |     SelectStatement<F, S, DistinctClause, W, O, LOf, G, H>: SelectQuery<SqlType = ST>,
        | |______________________________________________________________________________________^
        = note: the full name for the type has been written to '/home/lsunsi/Documents/issue161439/target/debug/deps/issue161439-1f91fb3dfe0d2c1c.long-type-2783650041364540002.txt'
        = note: consider using `--verbose` to print the full type name to the console
    
    error[E0277]: the trait bound `SelectStatement<FromClause<table>, DefaultSelectClause<_>, _, _, _, _, _, _, _>: Table` is not satisfied
       --> src/main.rs:13:24
        |
     13 |     users.for_update().distinct();
        |                        ^^^^^^^^ the trait `DistinctDsl` is not implemented for `SelectStatement<FromClause<table>, DefaultSelectClause<FromClause<table>>, _, _, _, _, _, _, _>`
        |
    help: the trait `DistinctDsl` is implemented for `diesel::internal::table_macro::SelectStatement<F, S, D, W, O, LOf, G, H>`
       --> /home/lsunsi/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/diesel-2.3.12/src/query_builder/select_statement/dsl_impls.rs:179:1
        |
    179 | / impl<ST, F, S, D, W, O, LOf, G, H> DistinctDsl for SelectStatement<F, S, D, W, O, LOf, G, H>
    180 | | where
    181 | |     Self: SelectQuery<SqlType = ST>,
    182 | |     SelectStatement<F, S, DistinctClause, W, O, LOf, G, H>: SelectQuery<SqlType = ST>,
        | |______________________________________________________________________________________^
        = note: the full name for the type has been written to '/home/lsunsi/Documents/issue161439/target/debug/deps/issue161439-1f91fb3dfe0d2c1c.long-type-2783650041364540002.txt'
        = note: consider using `--verbose` to print the full type name to the console
    
    error[E0277]: the trait bound `SelectStatement<FromClause<SelectStatement<_, _, _, _, _, _, _, _, _>>>: DistinctDsl` is not satisfied
       --> src/main.rs:13:24
        |
     13 |     users.for_update().distinct();
        |                        ^^^^^^^^ the trait `DistinctDsl` is not implemented for `SelectStatement<FromClause<SelectStatement<FromClause<table>, _, _, _, _, _, _, _, _>>>`
        |
        = note: a `DISTINCT` clause is not compatible with various other clauses like `LOCKING` clauses
    help: the trait `DistinctDsl` is conditionally implemented for `diesel::internal::table_macro::SelectStatement<F, S, D, W, O, LOf, G, H>`
       --> /home/lsunsi/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/diesel-2.3.12/src/query_builder/select_statement/dsl_impls.rs:179:1
        |
    179 |   impl<ST, F, S, D, W, O, LOf, G, H> DistinctDsl for SelectStatement<F, S, D, W, O, LOf, G, H>
        |   ^           - unsatisfied requirement introduced here: `DefaultSelectClause<FromClause<SelectStatement<_, _, _, _, _, _, _, _, _>>>: Sized`
        |  _|
        | |
    180 | | where
    181 | |     Self: SelectQuery<SqlType = ST>,
        | |                       ------------ unsatisfied requirement introduced here: `<SelectStatement<FromClause<_>> as SelectQuery>::SqlType == _`
    182 | |     SelectStatement<F, S, DistinctClause, W, O, LOf, G, H>: SelectQuery<SqlType = ST>,
        | |______________________________________________________________________________________^
        = note: the full name for the type has been written to '/home/lsunsi/Documents/issue161439/target/debug/deps/issue161439-1f91fb3dfe0d2c1c.long-type-6414551717105350805.txt'
        = note: consider using `--verbose` to print the full type name to the console
    
    For more information about this error, try `rustc --explain E0277`.
    error: could not compile `issue161439` (bin "issue161439") due to 3 previous errors
    
  6. weiznich commented on Aug 26, 2026

    @weiznich
    ContributorAuthor

    That looks much better. Thanks for investigating and fixing this issue ❤️

  7. added a commit that references this issue on Aug 26, 2026
    04c31be
  8. added a commit that references this issue on Aug 26, 2026
    f35d181
  9. added a commit that references this issue on Aug 27, 2026
    154f6b2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

A-diagnosticsArea: Messages for errors, warnings, and lintsD-verboseDiagnostics: Too much output caused by a single piece of incorrect code.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions