Files
rust/tests/ui/coercion
Jacob Pratt 59f27a4419 Rollup merge of #149219 - theemathas:coerce-unsized-shorten, r=jackh726
Allow shortening lifetime in CoerceUnsized for &mut

This modifies the &mut -> &mut CoerceUnsized impl so that, it can shorten the lifetime.

Note that there are already two impls that allow shortening the lifetime like this (the &mut T -> &U and the &T -> &U impls). So this change makes the impls consistent with each other.

I initially tried to also do the same to the CoerceUnsized impl for core::cell::{Ref, RefMut}. However, this can't be done because Ref and RefMut "store" the lifetime and the data in different fields, and CoerceUnsized can only coerce one field.

This change has an effect on stable code, since it allows shortening lifetimes inside invariant types via a &mut -> &mut unsize coercion.
2026-06-16 22:10:31 -04:00
..
2025-07-31 21:25:49 +05:00
2025-07-05 00:45:24 +05:00
2026-05-31 03:40:38 +02:00
2026-05-25 18:08:12 +02:00
2025-12-03 16:36:32 +00:00
2025-12-03 16:36:32 +00:00
2025-08-05 19:34:46 +05:00
2025-07-05 00:45:24 +05:00
2025-07-25 20:38:54 +05:00
2025-12-02 18:25:13 +00:00