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

Docs.rs does not compile on nightly since nightly-2024-04-05 #2488

Closed
dtolnay opened this issue Apr 6, 2024 · 7 comments
Closed

Docs.rs does not compile on nightly since nightly-2024-04-05 #2488

dtolnay opened this issue Apr 6, 2024 · 7 comments

Comments

@dtolnay
Copy link
Member

dtolnay commented Apr 6, 2024

This is to let you know that docs.rs is impacted by rust-lang/rust#119820, which is an upcoming intentional breaking change in Rust 1.79. There will need to be some code changes in docs.rs before updating to Rust 1.79.

$ cargo +nightly-2024-04-05 check

error: lifetime may not live long enough
  --> src/db/types.rs:4:66
   |
4  | #[derive(Debug, Clone, PartialEq, Eq, Serialize, FromSql, ToSql, sqlx::Type)]
   |                                                                  ^^^^^^^^^^
   |                                                                  |
   |                                                                  lifetime `'r` defined here
   |                                                                  requires that `'r` must outlive `'static`
   |
note: due to current limitations in the borrow checker, this implies a `'static` lifetime
  --> ~/.cargo/registry/src/index.crates.io-6f17d22bba15001f/sqlx-postgres-0.7.4/src/types/record.rs:97:12
   |
97 |         T: for<'a> Decode<'a, Postgres> + Type<Postgres>,
   |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   = note: this error originates in the derive macro `sqlx::Type` (in Nightly builds, run with -Z macro-backtrace for more info)

error: implementation of `sqlx::Decode` is not general enough
 --> src/db/types.rs:4:66
  |
4 | #[derive(Debug, Clone, PartialEq, Eq, Serialize, FromSql, ToSql, sqlx::Type)]
  |                                                                  ^^^^^^^^^^ implementation of `sqlx::Decode` is not general enough
  |
  = note: `std::string::String` must implement `sqlx::Decode<'0, Postgres>`, for any lifetime `'0`...
  = note: ...but it actually implements `sqlx::Decode<'1, Postgres>`, for some specific lifetime `'1`
  = note: this error originates in the derive macro `sqlx::Type` (in Nightly builds, run with -Z macro-backtrace for more info)

error: implementation of `sqlx::Decode` is not general enough
 --> src/db/types.rs:4:66
  |
4 | #[derive(Debug, Clone, PartialEq, Eq, Serialize, FromSql, ToSql, sqlx::Type)]
  |                                                                  ^^^^^^^^^^ implementation of `sqlx::Decode` is not general enough
  |
  = note: `Vec<std::string::String>` must implement `sqlx::Decode<'0, Postgres>`, for any lifetime `'0`...
  = note: ...but it actually implements `sqlx::Decode<'1, Postgres>`, for some specific lifetime `'1`
  = note: this error originates in the derive macro `sqlx::Type` (in Nightly builds, run with -Z macro-backtrace for more info)

https://gist.github.com/lcnr/7c1c652f30567048ea240554a36ed95c#httpsgithubcomlaunchbadgesqlx-some-derives-of-sqlxtype has an analysis of how sqlx is involved.

@syphar
Copy link
Member

syphar commented Apr 7, 2024

thanks for the ping!

It sounds like we just have to wait for the sqlx release, which I assume would happen before the new stable release?

@dtolnay
Copy link
Member Author

dtolnay commented Apr 7, 2024

I'm not sure about that. I tried building docs.rs with this change in Cargo.toml:

@@ -40,7 +40,7 @@ semver = { version = "1.0.4", features = ["serde"] }
 r2d2 = "0.8"
 r2d2_postgres = "0.18"
-sqlx = { version = "0.7", features = [ "runtime-tokio", "postgres", "chrono" ] }
+sqlx = { version = "0.8.0-alpha.0", features = [ "runtime-tokio", "postgres", "chrono" ] }
 url = { version = "2.1.1", features = ["serde"] }
 docsrs-metadata = { path = "crates/metadata" }
@@ -68,7 +68,7 @@ zip = {version = "0.6.2", default-features = false, features = ["bzip2"]}
 getrandom = "0.2.1"
 itertools = { version = "0.12.0", optional = true}
-rusqlite = { version = "0.30.0", features = ["bundled"] }
+rusqlite = { version = "0.31.0", features = ["bundled"] }
 hex = "0.4.3"
 
@@ -154,3 +154,6 @@ harness = false
 name = "cratesfyi"
 test = false
 doc = false
+
+[patch.crates-io]
+sqlx = { git = "https://github.com/launchbadge/sqlx" }

and while there are a few "mismatched types" errors in unrelated code from various breaking changes in those crates, I am still seeing all 3 of the original errors above related to sqlx::Type. So there may be more digging for you or @lcnr to do.

@lcnr
Copy link

lcnr commented Apr 7, 2024

I'll look into this 👍

@lcnr
Copy link

lcnr commented Apr 11, 2024

It sounds like we just have to wait for the sqlx release, which I assume would happen before the new stable release?

actually no, I messed up while looking at the regression. THis still requires a change to sqlx. Will open a PR and potentially delay the breaking change in rustc by one version to give users more time to update

@syphar
Copy link
Member

syphar commented Jun 15, 2024

@lcnr is there any update to this?

@lcnr
Copy link

lcnr commented Jun 15, 2024

launchbadge/sqlx#3185 has been fixed in sqlx now, so docs.rs should now be fixed once it uses the new version. The breaking change has been delayed by atleast one version, so docs.rs should still only be affected on beta (the new beta) and nightly for now.

@syphar
Copy link
Member

syphar commented Oct 18, 2024

docs.rs builds on nightly right now, I assume everything is fine now.

@syphar syphar closed this as completed Oct 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants