Skip to content

Commit a7ec2a5

Browse files
committed
add regression test to adress the issue outlined in rust-lang#119562
1 parent 08b80e9 commit a7ec2a5

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+
pointer: i32,
39+
}
40+
41+
let _: i32 = Pin::new(&mut Pinned { pointer: 0 }).pointer;
42+
}

0 commit comments

Comments
 (0)