Skip to content

Commit 7baae7c

Browse files
committed
add regression test to adress the issue outlined in rust-lang#119562
1 parent 8492c5a commit 7baae7c

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

library/core/tests/pin.rs

+11
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,14 @@ fn pin_const() {
2929

3030
pin_mut_const();
3131
}
32+
33+
#[test]
34+
fn dont_shadow() {
35+
// test that the pointer field does not shadow fields of the pinned data.
36+
37+
struct Pinned {
38+
pinned: i32,
39+
}
40+
41+
let _: i32 = Pin::new(&mut Pinned { pinned: 0 }).pinned;
42+
}

0 commit comments

Comments
 (0)