Skip to content

the trait sqlx_core::executor::Executor<'_> is not implemented #392

@grantcarthew

Description

@grantcarthew

Hi,

Just testing out sqlx for a project and the todo example fails. I followed the README.

# rustc 1.44.0 (49cae5576 2020-06-01)
# cargo 1.44.0 (05d080faa 2020-05-06)
# Postgres v12
# cargo run output:

grant@gdc:/data/sqlx/examples/postgres/todos$ cargo run -- add "todo thingy"
   Compiling sqlx-example-postgres-todos v0.1.0 (/data/sqlx/examples/postgres/todos)
error[E0277]: the trait bound `&mut &sqlx_core::pool::Pool<sqlx_core::postgres::database::Postgres>: sqlx_core::executor::Executor<'_>` is not satisfied
  --> examples/postgres/todos/src/main.rs:58:16
   |
58 |     .fetch_one(&mut pool)
   |                -^^^^^^^^
   |                |
   |                the trait `sqlx_core::executor::Executor<'_>` is not implemented for `&mut &sqlx_core::pool::Pool<sqlx_core::postgres::database::Postgres>`
   |                help: consider removing the leading `&`-reference
   |
   = help: the following implementations were found:
             <&sqlx_core::pool::Pool<DB> as sqlx_core::executor::Executor<'p>>

error[E0277]: the trait bound `&mut &sqlx_core::pool::Pool<sqlx_core::postgres::database::Postgres>: sqlx_core::executor::Executor<'_>` is not satisfied
  --> examples/postgres/todos/src/main.rs:73:14
   |
73 |     .execute(&mut pool)
   |              -^^^^^^^^
   |              |
   |              the trait `sqlx_core::executor::Executor<'_>` is not implemented for `&mut &sqlx_core::pool::Pool<sqlx_core::postgres::database::Postgres>`
   |              help: consider removing the leading `&`-reference
   |
   = help: the following implementations were found:
             <&sqlx_core::pool::Pool<DB> as sqlx_core::executor::Executor<'p>>

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0277`.
error: could not compile `sqlx-example-postgres-todos`.

To learn more, run the command again with --verbose.

I'm new to rust. This is the first bit of work I have done with it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions