diff --git a/library/core/tests/pin.rs b/library/core/tests/pin.rs index 6f617c8d0c297..ce0c6c6f85cf9 100644 --- a/library/core/tests/pin.rs +++ b/library/core/tests/pin.rs @@ -29,3 +29,14 @@ fn pin_const() { pin_mut_const(); } + +#[test] +fn dont_shadow() { + // test that the pointer field does not shadow fields of the pinned data. + + struct Pinned { + pinned: i32, + } + + let _: i32 = Pin::new(&mut Pinned { pinned: 0 }).pinned; +}