Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Diesel 2.0 released with errors when updating #57

@tyler-harpool

Description

@tyler-harpool

Diesel updated with version 2.0

Updated Cargo.toml

diesel = { version = "2.0.0", features = ["postgres", "uuid", "chrono", "r2d2"] }

See these errors:

warning: #[table_name] attribute form is deprecated
  = help: use `#[diesel(table_name = users)]` instead

error[E0308]: mismatched types
    --> src/user/service/list.rs:18:23
     |
18   |         .load::<User>(conn)?)
     |          ------------ ^^^^ types differ in mutability
     |          |
     |          arguments to this function are incorrect
     |
     = note: expected mutable reference `&mut _`
                        found reference `&diesel::r2d2::PooledConnection<diesel::r2d2::ConnectionManager<diesel::PgConnection>>`
note: associated function defined here
    --> /home//.cargo/registry/src/github.com-1ecc6299db9ec823/diesel-2.0.0/src/query_dsl/mod.rs:1497:8
     |
1497 |     fn load<'query, U>(self, conn: &mut Conn) -> QueryResult<Vec<U>>
     |        ^^^^

error[E0308]: mismatched types
    --> src/user/service/login.rs:18:24
     |
18   |         .first::<User>(conn)
     |          ------------- ^^^^ types differ in mutability
     |          |
     |          arguments to this function are incorrect
     |
     = note: expected mutable reference `&mut _`
                        found reference `&diesel::r2d2::PooledConnection<diesel::r2d2::ConnectionManager<diesel::PgConnection>>`
note: associated function defined here
    --> /home//.cargo/registry/src/github.com-1ecc6299db9ec823/diesel-2.0.0/src/query_dsl/mod.rs:1733:8
     |
1733 |     fn first<'query, U>(self, conn: &mut Conn) -> QueryResult<U>
     |        ^^^^^

error[E0308]: mismatched types
    --> src/user/service/register.rs:16:83
     |
16   |     let inserted_user: User = diesel::insert_into(users).values(&user).get_result(conn)?;
     |                                                                        ---------- ^^^^ types differ in mutability
     |                                                                        |
     |                                                                        arguments to this function are incorrect
     |
     = note: expected mutable reference `&mut _`
                        found reference `&diesel::PgConnection`
note: associated function defined here
    --> /home//.cargo/registry/src/github.com-1ecc6299db9ec823/diesel-2.0.0/src/query_dsl/mod.rs:1677:8
     |
1677 |     fn get_result<'query, U>(self, conn: &mut Conn) -> QueryResult<U>
     |        ^^^^^^^^^^

For more information about this error, try `rustc --explain E0308`.
error: could not compile `canduma` due to 3 previous errors

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