-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Closed
Copy link
Labels
C-cleanupCategory: PRs that clean code up or issues documenting cleanup.Category: PRs that clean code up or issues documenting cleanup.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.Relevant to the rustdoc team, which will review and decide on the PR/issue.
Description
Context:
- rustdoc: Add
ItemTemplate
trait and related functions to avoid repetitively wrapping existing functions #111946 (see section: existing discussion on how to solve this issue) - Removing only
.borrow()
calls will raise compilation errors - Initial idea of creating derive macros for
ItemTemplate
Would like to hear more ideas to tackle this problem, but this is my proposal (rough idea):
- Blanket impl of
ItemTemplate
for references:impl<T: ItemTemplate> ItemTemplate for &T
-
derive
macro forItemTemplate
; One might ask, is there a need for macros here?impl<T: ItemTemplate> askama::Template for &T
is required- Can't apply blanket impl because it involves an external trait
- So, we are left with implementing this trait for each
&T
, which can be done by copying the associated types and calling existing methods fromT
(basically making&T
behave the same asT
)
I suspect that we can gain more by creating macros here, but it is still under exploration.
Metadata
Metadata
Assignees
Labels
C-cleanupCategory: PRs that clean code up or issues documenting cleanup.Category: PRs that clean code up or issues documenting cleanup.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.Relevant to the rustdoc team, which will review and decide on the PR/issue.