Emsu opened a new issue, #22488:
URL: https://github.com/apache/datafusion/issues/22488
### What
\`datafusion/expr/src/expr.rs:638\` on \`main\` (also in the released
\`datafusion-expr 53.1.0\` at \`:520\`):
\`\`\`rust
intersected.retain(|k, v| metadata.get(k) == Some(v));
\`\`\`
\`HashMap::retain\` binds \`v: &mut V\`, so \`Some(v)\` is \`Option<&mut
String>\`. The right-hand side is \`Option<&String>\` from \`metadata.get(k)\`.
The standard \`Option<T>: PartialEq\` impl resolves cleanly when nothing else
is in scope — but when a transitive dep brings rkyv 0.7's blanket \`PartialEq\`
impls into scope, rustc 1.91.1 stops disambiguating and fails the comparison.
### Repro
\`\`\`toml
# Cargo.toml
[package]
name = "df-repro"
version = "0.1.0"
edition = "2024"
[dependencies]
datafusion-expr = "53.1.0"
chrono = { version = "0.4", features = ["rkyv-64"] } # pulls rkyv 0.7
transitively
\`\`\`
\`\`\`
$ rustc --version
rustc 1.91.1 (ed61e7d7e 2025-11-07)
$ cargo build
error[E0277]: can't compare \`Option<&std::string::String>\` with
\`Option<&mut std::string::String>\`
--> datafusion-expr-53.1.0/src/expr.rs:520:51
|
520 | intersected.retain(|k, v| metadata.get(k) == Some(v));
| ^^ no implementation
for ...
|
= help: the following other types implement trait \`PartialEq<Rhs>\`:
\`Option<T>\` implements \`PartialEq\`
\`Option<U>\` implements
\`PartialEq<rkyv::option::ArchivedOption<T>>\`
\`\`\`
Removing the \`chrono\` dep (or its \`rkyv-64\` feature) and the same code
builds. Dropping \`edition = "2024"\` from the consumer also makes it build.
### Suggested fix
\`\`\`diff
- intersected.retain(|k, v| metadata.get(k) == Some(v));
+ intersected.retain(|k, v| metadata.get(k) == Some(&*v));
\`\`\`
\`&*v\` reborrows \`&mut String\` as \`&String\`, eliminating the ambiguity
for the standard \`PartialEq\` impl regardless of what other impls are in
scope. Verified locally: patching the registry copy of \`datafusion-expr
53.1.0\`'s \`expr.rs:520\` to \`Some(&*v)\` makes the repro project build clean.
Happy to send a PR.
### Environment
- \`rustc 1.91.1 (ed61e7d7e 2025-11-07)\` on aarch64-apple-darwin
- \`datafusion-expr 53.1.0\` (latest released; same code on \`main\` at
\`:638\`)
- \`rkyv 0.7.46\` (resolved by chrono's \`rkyv-64\` feature)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]