160b26363Sopenharmony_ci/// Pins a value on the stack. 260b26363Sopenharmony_ci/// 360b26363Sopenharmony_ci/// # Example 460b26363Sopenharmony_ci/// 560b26363Sopenharmony_ci/// ```rust 660b26363Sopenharmony_ci/// # use pin_utils::pin_mut; 760b26363Sopenharmony_ci/// # use core::pin::Pin; 860b26363Sopenharmony_ci/// # struct Foo {} 960b26363Sopenharmony_ci/// let foo = Foo { /* ... */ }; 1060b26363Sopenharmony_ci/// pin_mut!(foo); 1160b26363Sopenharmony_ci/// let _: Pin<&mut Foo> = foo; 1260b26363Sopenharmony_ci/// ``` 1360b26363Sopenharmony_ci#[macro_export] 1460b26363Sopenharmony_cimacro_rules! pin_mut { 1560b26363Sopenharmony_ci ($($x:ident),* $(,)?) => { $( 1660b26363Sopenharmony_ci // Move the value to ensure that it is owned 1760b26363Sopenharmony_ci let mut $x = $x; 1860b26363Sopenharmony_ci // Shadow the original binding so that it can't be directly accessed 1960b26363Sopenharmony_ci // ever again. 2060b26363Sopenharmony_ci #[allow(unused_mut)] 2160b26363Sopenharmony_ci let mut $x = unsafe { 2260b26363Sopenharmony_ci $crate::core_reexport::pin::Pin::new_unchecked(&mut $x) 2360b26363Sopenharmony_ci }; 2460b26363Sopenharmony_ci )* } 2560b26363Sopenharmony_ci} 26