Repository: rust
Issue: Bad diagnostic on type mismatch for associated type requirements
Labels: A-diagnostics,T-compiler

### Code

```Rust
use diesel::prelude::*; // 2.1.6 without any features

table! {
    users {
        id -> Integer,
        name -> Text,
    }
}

table! {
    posts {
        id -> Integer,
        title -> Text,
        user_id -> Integer,
    }
}

fn main() {
    let sub_query = posts::table.find(42).select(posts::user_id).single_value();

    let user_query = users::table.filter(users::id.eq(sub_query));
}
```


### Current output

```Shell
error[E0271]: type mismatch resolving `<Grouped<Subselect<SelectStatement<FromClause<table>, SelectClause<user_id>, NoDistinctClause, WhereClause<Grouped<Eq<..., ...>>>, ..., ...>, ...>> as Expression>::SqlType == Integer`
  --> src/main.rs:21:52
   |
21 |     let user_query = users::table.filter(users::id.eq(sub_query));
   |                                                    ^^ expected `Nullable<Integer>`, found `Integer`
   |
   = note: expected struct `Nullable<diesel::sql_types::Integer>`
              found struct `diesel::sql_types::Integer`
   = note: required for `Grouped<Subselect<SelectStatement<FromClause<table>, SelectClause<user_id>, ..., ..., ..., ...>, ...>>` to implement `AsExpression<diesel::sql_types::Integer>`
   = note: the full name for the type has been written to '/tmp/diesel_bad_diagnostic/target/debug/deps/diesel_bad_diagnostic-98b497cf8fd64c49.long-type-7298064120992293895.txt'
   = note: consider using `--verbose` to print the full type name to the console
```


### Desired output

```Shell
error[E0271]: type mismatch resolving `<Grouped<Subselect<SelectStatement<FromClause<table>, SelectClause<user_id>, NoDistinctClause, WhereClause<Grouped<Eq<..., ...>>>, ..., ...>, ...>> as Expression>::SqlType == Integer`
  --> src/main.rs:21:52
   |
21 |     let user_query = users::table.filter(users::id.eq(sub_query));
   |                                          ^^^^^^^^^    ^^^^^^^^
   |                                          `Integer` `Nullable<Integer>`
   |
   = note: expected struct `Nullable<diesel::sql_types::Integer>`
              found struct `diesel::sql_types::Integer`
   = note: required for `Grouped<Subselect<SelectStatement<FromClause<table>, SelectClause<user_id>, ..., ..., ..., ...>, ...>>` to implement `AsExpression<diesel::sql_types::Integer>`
   = note: the full name for the type has been written to '/tmp/diesel_bad_diagnostic/target/debug/deps/diesel_bad_diagnostic-98b497cf8fd64c49.long-type-7298064120992293895.txt'
   = note: consider using `--verbose` to print the full type name to the console
```


### Rationale and extra context

It's currently not obviously clear which type is used for which part of the expression. For the presented case it would much easier for users to understand what's wrong if they could see which side of the expression has which type.

### Other cases

_No response_

### Rust Version

```Shell
$ rustc +nightly --version --verbose 
rustc 1.80.0-nightly (6e1d94708 2024-05-10)
binary: rustc
commit-hash: 6e1d94708a0a4a35ca7e46c6cac98adf62fe800e
commit-date: 2024-05-10
host: x86_64-unknown-linux-gnu
release: 1.80.0-nightly
LLVM version: 18.1.4
```


### Anything else?

_No response_