Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nightly build began to fail on sqlx #2855

Closed
nyurik opened this issue Nov 5, 2023 · 14 comments
Closed

Nightly build began to fail on sqlx #2855

nyurik opened this issue Nov 5, 2023 · 14 comments
Labels
bug:rust Indicates a bug or regression in Rust bug

Comments

@nyurik
Copy link
Contributor

nyurik commented Nov 5, 2023

Bug Description

Due to a recent rustc regression (rated as critical), sqlx can no longer compile on the latest nightly. This is NOT due to anything in the SQLX crate. This issue exists only to track the upstream bug, and will be closed as soon as upstream is fixed. See rust-lang/rust#117598

Minimal Reproduction

$ rustup toolchain install nightly
$ rustup update
$ cargo +nightly build

Info

  • SQLx version: latest git and 0.7
  • SQLx features enabled: default or "sqlite", "runtime-tokio"
  • Database server and version: n/a
  • Operating system: Linux Mint
  • rustc --version: rustc 1.75.0-nightly (4b85902b4 2023-11-04)

Error

   Compiling sqlx-core v0.7.2 (/home/nyurik/dev/rust/sqlx/sqlx-core)
warning: unused import: `WriteBuffer`
  --> sqlx-core/src/net/socket/mod.rs:10:36
   |
10 | pub use buffered::{BufferedSocket, WriteBuffer};
   |                                    ^^^^^^^^^^^
   |
   = note: `#[warn(unused_imports)]` on by default

error[E0308]: mismatched types
   --> sqlx-core/src/any/database.rs:32:21
    |
32  |     type Database = Any;
    |                     ^^^ lifetime mismatch
    |
    = note: expected associated type `<any::database::Any as HasValueRef<'r>>::Database`
               found associated type `<any::database::Any as HasValueRef<'r>>::Database`
note: the required lifetime does not necessarily outlive the lifetime `'r` as defined here
   --> sqlx-core/src/any/database.rs:31:6
    |
31  | impl<'r> HasValueRef<'r> for Any {
    |      ^^
note: the lifetime requirement is introduced here
   --> sqlx-core/src/database.rs:119:20
    |
119 |     type Database: Database;
    |                    ^^^^^^^^

error[E0308]: mismatched types
   --> sqlx-core/src/any/database.rs:32:21
    |
32  |     type Database = Any;
    |                     ^^^ lifetime mismatch
    |
    = note: expected associated type `<any::database::Any as HasValueRef<'r>>::Database`
               found associated type `<any::database::Any as HasValueRef<'r>>::Database`
note: the lifetime `'r` as defined here doesn't meet the lifetime requirements
   --> sqlx-core/src/any/database.rs:31:6
    |
31  | impl<'r> HasValueRef<'r> for Any {
    |      ^^
note: the lifetime requirement is introduced here
   --> sqlx-core/src/database.rs:119:20
    |
119 |     type Database: Database;
    |                    ^^^^^^^^

error[E0308]: mismatched types
   --> sqlx-core/src/any/database.rs:38:21
    |
38  |     type Database = Any;
    |                     ^^^ lifetime mismatch
    |
    = note: expected associated type `<any::database::Any as HasStatement<'q>>::Database`
               found associated type `<any::database::Any as HasStatement<'q>>::Database`
note: the required lifetime does not necessarily outlive the lifetime `'q` as defined here
   --> sqlx-core/src/any/database.rs:37:6
    |
37  | impl<'q> HasStatement<'q> for Any {
    |      ^^
note: the lifetime requirement is introduced here
   --> sqlx-core/src/database.rs:153:20
    |
153 |     type Database: Database;
    |                    ^^^^^^^^

error[E0308]: mismatched types
   --> sqlx-core/src/any/database.rs:38:21
    |
38  |     type Database = Any;
    |                     ^^^ lifetime mismatch
    |
    = note: expected associated type `<any::database::Any as HasStatement<'q>>::Database`
               found associated type `<any::database::Any as HasStatement<'q>>::Database`
note: the lifetime `'q` as defined here doesn't meet the lifetime requirements
   --> sqlx-core/src/any/database.rs:37:6
    |
37  | impl<'q> HasStatement<'q> for Any {
    |      ^^
note: the lifetime requirement is introduced here
   --> sqlx-core/src/database.rs:153:20
    |
153 |     type Database: Database;
    |                    ^^^^^^^^

error[E0308]: mismatched types
   --> sqlx-core/src/any/database.rs:44:21
    |
44  |     type Database = Any;
    |                     ^^^ lifetime mismatch
    |
    = note: expected associated type `<any::database::Any as HasArguments<'q>>::Database`
               found associated type `<any::database::Any as HasArguments<'q>>::Database`
note: the required lifetime does not necessarily outlive the lifetime `'q` as defined here
   --> sqlx-core/src/any/database.rs:43:6
    |
43  | impl<'q> HasArguments<'q> for Any {
    |      ^^
note: the lifetime requirement is introduced here
   --> sqlx-core/src/database.rs:135:20
    |
135 |     type Database: Database;
    |                    ^^^^^^^^

error[E0308]: mismatched types
   --> sqlx-core/src/any/database.rs:44:21
    |
44  |     type Database = Any;
    |                     ^^^ lifetime mismatch
    |
    = note: expected associated type `<any::database::Any as HasArguments<'q>>::Database`
               found associated type `<any::database::Any as HasArguments<'q>>::Database`
note: the lifetime `'q` as defined here doesn't meet the lifetime requirements
   --> sqlx-core/src/any/database.rs:43:6
    |
43  | impl<'q> HasArguments<'q> for Any {
    |      ^^
note: the lifetime requirement is introduced here
   --> sqlx-core/src/database.rs:135:20
    |
135 |     type Database: Database;
    |                    ^^^^^^^^

For more information about this error, try `rustc --explain E0308`.
warning: `sqlx-core` (lib) generated 1 warning (1 duplicate)
error: could not compile `sqlx-core` (lib) due to 6 previous errors; 1 warning emitted
warning: build failed, waiting for other jobs to finish...
warning: `sqlx-core` (lib) generated 1 warning
error: could not compile `sqlx-core` (lib) due to 6 previous errors; 1 warning emitted
@nyurik nyurik added the bug label Nov 5, 2023
@HTGAzureX1212
Copy link

Just encountered the very same error today.

@nyurik
Copy link
Contributor Author

nyurik commented Nov 5, 2023

I also filed a short version of this bug at rust-lang/rust#117598

@abonander
Copy link
Collaborator

I'll leave this open for informational purposes but it sounds like it needs to be fixed upstream.

Feel free to close when that happens.

@lirannl
Copy link

lirannl commented Nov 7, 2023

Can confirm this also applies to rust beta (1.74) and stable (1.73), and sqlx 0.7.1 and 0.7.0, regardless of locked-ness.

@rakshith-ravi
Copy link
Contributor

rakshith-ravi commented Nov 8, 2023

Can confirm this also applies to rust beta (1.74) and stable (1.73), and sqlx 0.7.1 and 0.7.0, regardless of locked-ness.

Stable rust seems to work fine. I haven't tested beta, but I am able to build just fine on stable

Edit: Are you sure there's no rust-toolchain.toml that's forcing nightly by any chance?

@nyurik
Copy link
Contributor Author

nyurik commented Nov 8, 2023

This is not a sqlx issue, but lots of people might see this bug if they try to build their own code with the nightly toolchain due to a recent Rust regression. I updated the description to clarify that.

@amiller68
Copy link

I noticed the rust-lang issue has been marked as closed, but I'm still running into this in CI. Have not tested locally, but is anyone else still struggling with this?

@LeviticusNelson
Copy link

@amiller68 I'm certain it's because nightly-2023-11-08 has not been released on rustup yet.

@amiller68
Copy link

u right u right my bad

@Cyberphinx
Copy link

I'm having the same issue

@Ltrlg
Copy link

Ltrlg commented Nov 9, 2023

The nightly-2023-11-09 toolchain (with rustc 2023-11-08) is available and seems to indeed be working.

@mattrighetti
Copy link
Contributor

rustc 1.75.0-nightly fixed the issue it seems

@luke-milavec
Copy link

still having issues on rustc 1.75.0-nightly

@nyurik
Copy link
Contributor Author

nyurik commented Nov 15, 2023

@luke-milavec run rustup update first. Then post the result of rustc +nightly -V

saramic added a commit to saramic/learning that referenced this issue Jun 15, 2024
Had a bunch of issues following the text
- corresponding_question vs question_id in a bunch of queries
- not RETURNING id, content, corresponding_question" from insert
- comile errors between rust 1.73 and sqlx 0.7.4
  ```
  error[E0658]: `async fn` return type cannot contain a projection
      or `Self` that references lifetimes from a parent scope error:

  could not compile `sqlx-core`
  ```
    - launchbadge/sqlx#2855 (comment)
    - updated with
      ```sh
      rustc --version
      rustc 1.73
      rustup update
      rustc --version
      rustc 1.78.0
      cargo --version
      cargo 1.78.0
      ```
- but got there in the end
- try:
    just
    just clean
    just setup-db
    cargo run
    just demo-crud
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug:rust Indicates a bug or regression in Rust bug
Projects
None yet
Development

No branches or pull requests