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

Automatic edition migration broken for diesel. #136345

Open
weiznich opened this issue Jan 31, 2025 · 3 comments
Open

Automatic edition migration broken for diesel. #136345

weiznich opened this issue Jan 31, 2025 · 3 comments
Labels
C-bug Category: This is a bug. E-needs-investigation Call for partcipation: This issues needs some investigation to determine current status E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example T-cargo Relevant to the cargo team, which will review and decide on the PR/issue. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@weiznich
Copy link
Contributor

I tried this code:

diesel-rs/diesel@1c5cf1c

and followed the setups outlined here to test migrating to the 2024 edition.

I expected to see this happen: Migration succeeds
Instead, this happened: I get the following compiler errors: Gist link as the log is too large to even post it inline
I did not investigate why which error happens, but it seems like that there is again something strange going on with feature unification, as otherwise you wouldn't end up with this kind of error messages that mix different backend types like this.

I also want to highlight that this is now the third edition in row that breaks diesel and that requires significant manual migration effort on our side. At least for me that doesn't uphold the promises made by various edition RFC's and team members.

Meta

rustc --version --verbose:

rustc 1.85.0-beta.6 (14445aaf3 2025-01-26)
binary: rustc
commit-hash: 14445aaf35d45f62fddda8cb5027f44ba4316e7f
commit-date: 2025-01-26
host: x86_64-unknown-linux-gnu
release: 1.85.0-beta.6
LLVM version: 19.1.7
@weiznich weiznich added the C-bug Category: This is a bug. label Jan 31, 2025
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jan 31, 2025
@jieyouxu jieyouxu added E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example E-needs-investigation Call for partcipation: This issues needs some investigation to determine current status A-edition-2024 Area: The 2024 edition T-cargo Relevant to the cargo team, which will review and decide on the PR/issue. T-edition Relevant to the edition team. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jan 31, 2025
@jieyouxu

This comment has been minimized.

@jieyouxu
Copy link
Member

As @weiznich suggested, I can repro with cargo +beta fix --edition --features="postgres sqlite mysql extras".

@ehuss
Copy link
Contributor

ehuss commented Feb 1, 2025

This does not appear to be directly related to the edition, nor with anything new. If you run cargo check -p diesel --profile=test --features "postgres sqlite", you will see that it also fails. Similarly for cargo test -p diesel --features "postgres sqlite". There appears to be an issue with how those tests work with diesel_derive with those multiple features enabled. I don't immediately see what the issue is, but I am not familiar with diesel. I notice that diesel forwards the sqlite feature to diesel_derives, but it does not for mysql or postgres, which I think might be related (not sure if this is related to rust-lang/cargo#14415).

cargo fix implicitly enables --all-targets which means that it will attempt to migrate tests. I would suggest when you migrate to migrate individual packages and targets, and with individual features as needed. For example, the following should work:

  • cargo fix --edition --lib -p diesel
  • cargo fix --edition --tests -p diesel --features sqlite

and do individual features as needed.

@jieyouxu jieyouxu removed A-edition-2024 Area: The 2024 edition T-edition Relevant to the edition team. labels Feb 1, 2025
@saethlin saethlin removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Feb 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. E-needs-investigation Call for partcipation: This issues needs some investigation to determine current status E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example T-cargo Relevant to the cargo team, which will review and decide on the PR/issue. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

5 participants