-
Notifications
You must be signed in to change notification settings - Fork 330
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
Compilation error with url 2.5.3 / idna 1.0.3 with Rust < 1.81 and edition 2021 (resolver 2) when sqlx-core is in the dependency graph #992
Comments
@TotalKrill |
We are depending on url, not idna directly |
@valenting seems i was wrong about 1.81.0, seems to work there... |
Are you depending on I tried to repro on 1.80.1, and the following compiles: rustup default 1.80
cargo new --bin testurl
cd testurl
cargo add url
cargo build |
we have a workspace, but we only depend on url like this: |
running this is what our tree ends up including, with two different versions of URL included, probably by one of our other deps.
Edit: I meant version 2.5.3, 2.5.0 is the version that compiles |
The introduction of Do you somehow have |
Oh sorry, I am currently forcing our software to take 2.5.0, since 2.5.3 does not compile. Updated the previous comment to show that the cargo tree command showed 2.5.3 |
So if you have Aside: This isn't specific to idna. If I use Rust 1.80.1 with: [dependencies]
url = { version = "2.5.3", default-features = false }
idna = "1" ... |
Might fix CI failures caused by this: servo/rust-url#992. Slack thread: https://posthog.slack.com/archives/C0113360FFV/p1730722228558389
Fixes CI failures caused by this: servo/rust-url#992. Slack thread: https://posthog.slack.com/archives/C0113360FFV/p1730722228558389
yep, my edited comment stands. But with what you say, something else might be changing to |
As long as something in your dependency graph depends on @Twixes, GitHub autolinks a couple of your changesets referencing this issue. Do you have minimized steps to reproduce? |
I think |
Just felt this through my direct dependency to minimal verifiable example:
And I get the same compilation error as @TotalKrill The latest version of SQLx is (for the benefit of solution-seekers pinning to cargo --version --verbose
rustc --version --verbose
|
Interestingly, this turns out not to be true. rustup default 1.80
cargo new idna-992-repro
cd idna-992-repro/
cargo add sqlx
cargo add url
cargo check Still fails. (Note the added @domenukk why does |
We are also using sqlx, so might be through that |
|
@hsivonen I pinned |
Do you mean PostHog/posthog@5f6e5d1 fixed it for you? That's really weird. By what mechanism should that help? |
Actually you are right, the For us, the issue was with this command: By appending |
The sqlx change that added |
Filed an sqlx issue: launchbadge/sqlx#3589 |
Have you figured that one out? I feel like it should? Different versions of the |
I have not.
I agree. Could this be a Cargo bug? The unusual thing that I notice is that the Can an exact version dependency up the graph from
No, |
Posted a request for help with figuring out why Cargo is doing what it does: |
Not really sure why we had Because of Cargo's feature unification, it becomes very difficult to turn off default features for a crate that's deep in your dependency tree, since any other crate in the tree that depends on it but neglects to set I think one of the last times we ran into this we just added It's a really weird situation that disabling a feature leads to an increase in the MSRV. I would consider this an unintentional breakage of the I understand that as a more "fundamental" crate than SQLx, |
I see where you're coming from, but I also slightly disagree: I think it's pretty much a norm for crates to assume that splitting out code into a feature but including it in default is not a breaking change, so in this case you're open to breakages. It's a tradeoff. There have been proposals for being able to say which version your feature spec is based on. |
I also feel like this at least used to be somewhat expectable back in the days when no_std was not as polished. But I haven't seen that in ages. |
(I edited the issue description to put solutions at the top of the page at this point in the thread.) |
Edited by @hsivonen to put resolution options at the top for folks who come here:
This compilation error is due to a combination of:
url
, and from a proc macro context specifically. (Request for SQLx not to do that: Please do not turn off default features for url launchbadge/sqlx#3589)url
2.5.3 (andidna
1.0.3) conditionally raising MSRV to 1.81 when default features are off. (Fromno_std
support for theurl
crate #831)resolver = "2"
, which is implied byedition = "2021"
performing feature resolution for proc macro dependencies separately from normal dependencies, so a normal dependency onurl
with default features enabled does not cause default features to be enabled for the proc macro case.The most obvious way to resolve this compilation error is to upgrade Rust to 1.81 or later. (If you are using SQLx 0.8.x, your Rust version has to already be 1.79 or later, so it's not a big jump.)
Alternative resolution without upgrading Rust:
resolver = "1"
in the[workspace]
section of your top-levelCargo.toml
. If there's no such section yet, create a[workspace]
section at the top of your top-levelCargo.toml
.url
with default features enabled somewhere in your dependency graph, addurl = "2.5.3"
to the[dependencies]
section of one of your crates (the top-level is the most obvious place, but it does not have to be on the top level).(Conditionally raising MSRV to 1.81 is not a semver break, because raising MSRV isn't a semver break.)
Original report follows:
Describe the bug
After update to v1.0.3 wich is picked up automatically since its a patch upgrade, our code no longer compiles the same.
rust versions tested:
The text was updated successfully, but these errors were encountered: