Skip to main content

rewrite_opaque_returns

Function rewrite_opaque_returns 

Source
pub fn rewrite_opaque_returns(sig: &mut Signature)
Expand description

Appends + use<> to every opaque type in sig’s return position, inside an async fn’s return type included, so a reply outlives the call: on edition 2024 an opaque return type captures &self’s lifetime whatever the hidden type borrows.

Left as written: every opaque type of a handler with a type or const parameter, and an opaque type that already names a use<..> bound or a lifetime other than 'static, an elided reference such as Item = &str included. A stream that borrows self then fails inside the handler body; the idiom is self: Arc<Self> as the receiver.