diff options
Diffstat (limited to 'third_party/rust/pin-utils/tests/stack_pin.rs')
-rw-r--r-- | third_party/rust/pin-utils/tests/stack_pin.rs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/third_party/rust/pin-utils/tests/stack_pin.rs b/third_party/rust/pin-utils/tests/stack_pin.rs new file mode 100644 index 0000000000..4b6758dc12 --- /dev/null +++ b/third_party/rust/pin-utils/tests/stack_pin.rs @@ -0,0 +1,21 @@ +#![forbid(unsafe_code)] // pin_mut! is completely safe. + +use pin_utils::pin_mut; +use core::pin::Pin; + +#[test] +fn stack_pin() { + struct Foo {} + let foo = Foo {}; + pin_mut!(foo); + let _: Pin<&mut Foo> = foo; + + let bar = Foo {}; + let baz = Foo {}; + pin_mut!( + bar, + baz, + ); + let _: Pin<&mut Foo> = bar; + let _: Pin<&mut Foo> = baz; +} |