mirror of
https://github.com/allankoechke/rust.git
synced 2026-12-02 01:40:02 +00:00
Implement derives for Reborrow and CoerceShared This adds built-in derive support for the experimental `Reborrow` and `CoerceShared` marker traits behind `#![feature(reborrow)]`. The derives generate the same marker impls users would write manually, while preserving the existing coherence and structural validation path for the experimental reborrow traits. ## Please note this impl: - Preserves generics, lifetimes, const params, and where clauses in generated impls. - Preserves multiple lifetime parameters in generated impls instead of duplicating the current experimental one-lifetime limitation in the derive layer. - Requires an explicit `CoerceShared` target type through the derive helper attribute. - Adds UI coverage for valid derives, feature gating, malformed helper attributes, unsupported item kinds, validation failures, and multiple-lifetime derive behavior. - Makes the derive layer future-proof for multiple lifetimes: it preserves all lifetime parameters and generates the same impl shape as a manual impl. @rustbot label F-reborrow Tracking: https://github.com/rust-lang/rust/issues/145612