Skip to content

Lifetime issue with latest Rust nightly (1.64.0-nightly) #2004

@kimpers

Description

@kimpers

Hi!

First of all thank you for maintaining an awesome library 🙏 I'm having some issues using SQLX (v0.6 or v0.5.12) with the latest Rust nightly version (1.64.0-nightly (2643b1646 2022-07-27).

After updating my Rust version I started getting these errors wherever I use the query* macros

error[E0107]: missing generics for trait `HasArguments`
   --> src/main.rs:64:25
    |
64  |       let rows_affected = sqlx::query!(
    |  _________________________^
65  | |         r#"
66  | | UPDATE todos
67  | | SET done = TRUE
...   |
70  | |         id
71  | |     )
    | |_____^ expected 1 lifetime argument
    |
note: trait defined here, with 1 lifetime parameter: `'q`
   --> /Users/X/.cargo/registry/src/github.com-1ecc6299db9ec823/sqlx-core-0.6.0/src/database.rs:127:11
    |
127 | pub trait HasArguments<'q> {
    |           ^^^^^^^^^^^^ --
    = note: this error originates in the macro `$crate::sqlx_macros::expand_query` which comes from the expansion of the macro `sqlx::query` (in Nightly builds, run with -Z macro-backtrace for more info)
help: add missing lifetime argument
   --> |/Users/X/.cargo/registry/src/github.com-1ecc6299db9ec823/sqlx-0.6.0/src/macros.rs:304:9
    |
304 |         HasArguments<'q>

I created a minimal repro case using the sqlite example project at https://github.com/kimpers/sqlx-todos-example. If you try to build this with 1.64.0 it will fail with the above described issue.

Any ideas of how to fix this issue?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug:rustIndicates a bug or regression in Rust

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions