fix: resolve E0119 trait coherence error in rustc >= 1.95.0#786
Conversation
Replaced the use of the associated type `< as ModifierValue>::Type` with the concrete type via `target_ty!( ?)` in the generated `From` trait implementations inside `format_item.rs`. This prevents trait coherence conflicts (E0119) in newer versions of the Rust compiler (1.95.0+), which are stricter about blanket implementations and associated types overlapping with downstream generic implementations (such as in `cookie` or `actix-web`).
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #786 +/- ##
=====================================
Coverage 88.4% 88.4%
=====================================
Files 99 99
Lines 13079 13079
=====================================
+ Hits 11556 11557 +1
+ Misses 1523 1522 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This comment was marked as spam.
This comment was marked as spam.
|
Stop pinging people. It is obnoxious and will get you blocked. |
This comment was marked as low quality.
This comment was marked as low quality.
|
any eta on when this will be merged. getting the same issue in my codebase |
|
The version in question has been yanked from crates.io. As such, there is no urgency. If I get more |
|
I think this fix is likely correct, as these impls are almost certainly triggering a rustc bug I've encountered before: rust-lang/rust#85898 |
|
Christ that's an old bug. Must not be terribly easy to fix if it's been around for over a decade. Given that this already has a known compiler bug, I've got to agree that this is the fix. I'll get back around to it later before releasing. |
|
This seems like the sort of thing that will be fixed, or at least the fix unblocked, by the new trait solver. Which is actually getting very close to passing a full crater run, AFAIK. |
|
I've posted a minimal repro in the issue thread: #783 (comment). Based on testing, I confirm that the issue is related to the usage of the associated type in Since both The macro is already defining the associated type using So reusing it to define the impl target is the right thing to do, the fix in the PR is correct. |
Replaced the use of the associated type
< as ModifierValue>::Typewith the concrete type viatarget_ty!( ?)in the generatedFromtrait implementations insideformat_item.rs.This prevents trait coherence conflicts (E0119) in newer versions of the Rust compiler (1.95.0+), which are stricter about blanket implementations and associated types overlapping with downstream generic implementations (such as in
cookieoractix-web).