1 | #![forbid(unsafe_code)] // pin_mut! is completely safe. |
---|---|
2 | |
3 | use pin_utils::pin_mut; |
4 | use core::pin::Pin; |
5 | |
6 | #[test] |
7 | fn stack_pin() { |
8 | struct Foo {} |
9 | let foo = Foo {}; |
10 | pin_mut!(foo); |
11 | let _: Pin<&mut Foo> = foo; |
12 | |
13 | let bar = Foo {}; |
14 | let baz = Foo {}; |
15 | pin_mut!( |
16 | bar, |
17 | baz, |
18 | ); |
19 | let _: Pin<&mut Foo> = bar; |
20 | let _: Pin<&mut Foo> = baz; |
21 | } |
22 |