summaryrefslogtreecommitdiffstats
path: root/vendor/pin-utils/tests/stack_pin.rs
blob: 4b6758dc123827bf24c99002e8ee90bb32f41d2f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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;
}