Skip to content

Commit

Permalink
add regression test to adress the issue outlined in rust-lang#119562
Browse files Browse the repository at this point in the history
  • Loading branch information
joboet committed Jan 5, 2024
1 parent 08b80e9 commit 89f56a8
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions library/core/tests/pin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

0 comments on commit 89f56a8

Please sign in to comment.