Files
rust/compiler/rustc_span
Jonathan Brouwer 8cd8b73209 Rollup merge of #156338 - P8L1:derive-reborrow-coerce-shared, r=oli-obk
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
2026-08-11 11:14:51 +02:00
..