Repository: rust
Issue: Broken method resolution for arc-swap + diesel
Labels: A-resolve,C-bug,T-types

<!--
Thank you for filing a bug report! 🐛 Please provide a short summary of the bug,
along with any information you feel relevant to replicating the bug.
-->

I tried this code:

```rust
use arc_swap::ArcSwap; // arc-swap = "1.7.1"
use diesel_async::RunQueryDsl; // diesel-async = "0.4.1"
use std::sync::Arc;

fn issue(arc: ArcSwap<Arc<String>>) {
    let v = arc.load();
}
```

I expected to see this happen: Code compiles without error as [`ArcSwap::load()`](https://docs.rs/arc-swap/1.7.1/arc_swap/struct.ArcSwapAny.html#tymethod.load) exists

Instead, this happened: Code fails to compile with the following error:

```
error[E0277]: the trait bound `ArcSwapAny<Arc<Arc<String>>>: diesel::query_builder::Query` is not satisfied
 --> src/main.rs:7:17
  |
7 |     let v = arc.load();
  |                 ^^^^ the trait `diesel::query_builder::Query` is not implemented for `ArcSwapAny<Arc<Arc<String>>>`, which is required by `ArcSwapAny<Arc<Arc<String>>>: LoadQuery<'_, _, _>`
  |
  = help: the following other types implement trait `diesel::query_builder::Query`:
            &'a T
            diesel::expression::sql_literal::SqlLiteral<ST, T>
            diesel::expression::sql_literal::UncheckedBind<Q, Value>
            diesel::query_builder::combination_clause::CombinationClause<Combinator, Rule, Source, Rhs>
            diesel::query_builder::delete_statement::DeleteStatement<T, U, diesel::query_builder::returning_clause::ReturningClause<Ret>>
            diesel::query_builder::insert_statement::InsertStatement<T, U, Op, diesel::query_builder::returning_clause::ReturningClause<Ret>>
            diesel::query_builder::select_statement::SelectStatement<F, S, D, W, O, LOf, G, H, LC>
            diesel::query_builder::select_statement::boxed::BoxedSelectStatement<'a, ST, QS, DB, GB>
          and 6 others
  = note: required for `ArcSwapAny<Arc<Arc<String>>>` to implement `diesel::query_builder::AsQuery`
  = note: required for `ArcSwapAny<Arc<Arc<String>>>` to implement `LoadQuery<'_, _, _>`

error[E0277]: the trait bound `ArcSwapAny<Arc<Arc<String>>>: diesel::query_builder::QueryFragment<_>` is not satisfied
 --> src/main.rs:7:17
  |
7 |     let v = arc.load();
  |                 ^^^^ the trait `diesel::query_builder::QueryFragment<_>` is not implemented for `ArcSwapAny<Arc<Arc<String>>>`, which is required by `ArcSwapAny<Arc<Arc<String>>>: LoadQuery<'_, _, _>`
  |
  = help: the following other types implement trait `diesel::query_builder::QueryFragment<DB, SP>`:
            <&'a T as diesel::query_builder::QueryFragment<DB>>
            <() as diesel::query_builder::QueryFragment<DB>>
            <(T0, T1) as diesel::query_builder::QueryFragment<__DB>>
            <(T0, T1, T2) as diesel::query_builder::QueryFragment<__DB>>
            <(T0, T1, T2, T3) as diesel::query_builder::QueryFragment<__DB>>
            <(T0, T1, T2, T3, T4) as diesel::query_builder::QueryFragment<__DB>>
            <(T0, T1, T2, T3, T4, T5) as diesel::query_builder::QueryFragment<__DB>>
            <(T0, T1, T2, T3, T4, T5, T6) as diesel::query_builder::QueryFragment<__DB>>
          and 160 others
  = note: required for `ArcSwapAny<Arc<Arc<String>>>` to implement `LoadQuery<'_, _, _>`

error[E0277]: the trait bound `ArcSwapAny<Arc<Arc<String>>>: diesel::query_builder::query_id::QueryId` is not satisfied
 --> src/main.rs:7:17
  |
7 |     let v = arc.load();
  |                 ^^^^ the trait `diesel::query_builder::query_id::QueryId` is not implemented for `ArcSwapAny<Arc<Arc<String>>>`, which is required by `ArcSwapAny<Arc<Arc<String>>>: LoadQuery<'_, _, _>`
  |
  = help: the following other types implement trait `diesel::query_builder::query_id::QueryId`:
            &'a T
            ()
            (T0, T1)
            (T0, T1, T2)
            (T0, T1, T2, T3)
            (T0, T1, T2, T3, T4)
            (T0, T1, T2, T3, T4, T5)
            (T0, T1, T2, T3, T4, T5, T6)
          and 148 others
  = note: required for `ArcSwapAny<Arc<Arc<String>>>` to implement `LoadQuery<'_, _, _>`

error[E0277]: the trait bound `ArcSwapAny<Arc<Arc<String>>>: LoadQuery<'_, _, _>` is not satisfied
   --> src/main.rs:7:17
    |
7   |     let v = arc.load();
    |                 ^^^^ the trait `diesel::query_builder::QueryFragment<_>` is not implemented for `ArcSwapAny<Arc<Arc<String>>>`, which is required by `ArcSwapAny<Arc<Arc<String>>>: LoadQuery<'_, _, _>`
    |
    = note: required for `ArcSwapAny<Arc<Arc<String>>>` to implement `LoadQuery<'_, _, _>`
note: required by a bound in `diesel_async::RunQueryDsl::load`
   --> /home/weiznich/.cargo/registry/src/index.crates.io-6f17d22bba15001f/diesel-async-0.4.1/src/run_query_dsl/mod.rs:338:15
    |
331 |     fn load<'query, 'conn, U>(
    |        ---- required by a bound in this associated function
...
338 |         Self: methods::LoadQuery<'query, Conn, U> + 'query,
    |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `RunQueryDsl::load`

error[E0061]: this method takes 1 argument but 0 arguments were supplied
   --> src/main.rs:7:17
    |
7   |     let v = arc.load();
    |                 ^^^^-- an argument of type `&mut _` is missing
    |
note: method defined here
   --> /home/weiznich/.cargo/registry/src/index.crates.io-6f17d22bba15001f/diesel-async-0.4.1/src/run_query_dsl/mod.rs:331:8
    |
331 |     fn load<'query, 'conn, U>(
    |        ^^^^
help: provide the argument
    |
7   |     let v = arc.load(/* conn */);
    |                     ~~~~~~~~~~~~

warning: unused import: `arc_swap::access::Access`
 --> src/main.rs:1:5
  |
1 | use arc_swap::access::Access;
  |     ^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default
```

The method provided by diesel does clearly not apply as:

* It takes a different number of arguments
* The trait bounds on the message are not fulfilled. 

### Meta
<!--
If you're using the stable version of the compiler, you should also check if the
bug also exists in the beta or nightly versions.
-->

`rustc --version --verbose`:
```
rustc 1.79.0 (129f3b996 2024-06-10)
binary: rustc
commit-hash: 129f3b9964af4d4a709d1383930ade12dfe7c081
commit-date: 2024-06-10
host: x86_64-unknown-linux-gnu
release: 1.79.0
LLVM version: 18.1.7

```
(Although the same behavior can be observed with the latest nightly compiler)

<!--
Include a backtrace in the code block by setting `RUST_BACKTRACE=1` in your
environment. E.g. `RUST_BACKTRACE=1 cargo build`.
-->
<details><summary>Backtrace</summary>
<p>

```
<backtrace>
```

</p>
</details>