Files
rust/tests/ui/pin-macro/pin_move.rs
Mara Bos 163ea4acd0 Add more tests for pin!().
Co-authored-by: Daniel Henry-Mantilla <daniel.henry.mantilla@gmail.com>
2025-03-29 08:10:15 +01:00

27 lines
454 B
Rust

//@ edition:2024
use core::marker::PhantomPinned;
use core::pin::pin;
fn a() {
struct NotCopy<T>(T);
#[allow(unused_mut)]
let mut pointee = NotCopy(PhantomPinned);
pin!(pointee);
let _moved = pointee;
//~^ ERROR use of moved value
}
fn b() {
struct NotCopy<T>(T);
let mut pointee = NotCopy(PhantomPinned);
pin!(*&mut pointee);
//~^ ERROR cannot move
let _moved = pointee;
}
fn main() {
a();
b();
}