fix: avoid associated type projection in modifier! From impl#784
fix: avoid associated type projection in modifier! From impl#784xlfish233 wants to merge 1 commit into
Conversation
The modifier! macro generates From<> using the associated type projection <ModifierValue>::Type, which confuses the new trait solver (next-solver=coherence, default since Rust 1.84) during coherence checking. The solver cannot normalize the projection, causing false positive E0119 conflicts with blanket From<T> impls in downstream crates. Replace the projection with the concrete type via target_ty!, which the macro already uses for ModifierValue::Type. The generated code is identical, but avoids the opaque projection.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #784 +/- ##
=====================================
Coverage 88.4% 88.4%
=====================================
Files 99 99
Lines 13079 13079
=====================================
+ Hits 11556 11559 +3
+ Misses 1523 1520 -3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
error spot at like: Checking cookie v0.18.1 For more information about this error, try error: could not compile |
|
"This change has no effect on time's behavior, but resolves false-positive E0119 compilation errors in downstream crates like cookie, tracing-subscriber,and salvo_core." |
|
Works for me. Added [patch.crates-io]
time = { git = "https://github.com/xlfish233/time-fix.git", branch = "fix/coherence-e0119" }in my |
time 0.3.48 added an impl that trips rustc's coherence check (E0119) against any crate carrying a blanket `From` impl. fea-rs's `impl<T: Into<GlyphName>> From<T> for GlyphIdent` is among them, and this breaks the cargo doc and clippy CI jobs under --all-features (time reaches fea-rs via plist -> norad). Pin time to =0.3.47 in the workspace until the upstream fix (time-rs/time#784) ships in 0.3.49. See time-rs/time#783.
|
Just as a note, I tested with |
…3e8b1250634072cab Partially revert `58879b2` (see time-rs/time#784)
Could you give me more context of failure env, for current context i can't figure the root cause of your breakge. |
…file Keep the smoke test on fresh crates.io resolution (it doubles as an ecosystem canary for cargo-gbuild users) and substitute the broken time 0.3.48 with the rev-pinned branch of time-rs/time#784 until the fix is released. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Thank for the note,i confirmed it actually not the root casue. And i found diff between 0.3.47 and 0.3.48. Actually author just changed : impl From<$name> for target_ty!($name $($target_ty)?) {0.3.48 (broken): impl From<$name> for <$name as ModifierValue>::Type { |
|
I merged #786 as that also changes |
time 0.3.49 shipped the upstream fix for the 0.3.48 coherence regression (time-rs/time#784), so the equality pin is no longer needed. Drops both the workspace pin and the fontc shim that only existed to make it bite. Verified cargo doc --workspace --all-features (the CI job that broke) is clean with time 0.3.51. Fixes #2042.
The modifier! macro generates From<> using the associated type projection ::Type, which confuses the new trait solver (next-solver=coherence, default since Rust 1.84) during coherence checking. The solver cannot normalize the projection, causing false positive E0119 conflicts with blanket From impls in downstream crates.
Replace the projection with the concrete type via target_ty!, which the macro already uses for ModifierValue::Type. The generated code is identical, but avoids the opaque projection.