Skip to content

Commit

Permalink
Replace references of static externs to addr_of!. We need to do this …
Browse files Browse the repository at this point in the history
…because of rust-lang/rust#114447
  • Loading branch information
Askar Safin committed Apr 3, 2024
1 parent 7819c5b commit 4125710
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1716,7 +1716,8 @@ impl<'a> Generator<'a> {
fn __test_static_{name}() -> {ty};
}}
unsafe {{
same(*(&{name} as *const _ as *const {ty}) as usize,
// We must use addr_of! here because of https://github.com/rust-lang/rust/issues/114447
same(*(std::ptr::addr_of!({name}) as *const {ty}) as usize,
__test_static_{name}() as usize,
"{name} static");
}}
Expand Down Expand Up @@ -1760,7 +1761,8 @@ impl<'a> Generator<'a> {
fn __test_static_{name}() -> *{mutbl} {ty};
}}
unsafe {{
same(&{name} as *const _ as usize,
// We must use addr_of! here because of https://github.com/rust-lang/rust/issues/114447
same(std::ptr::addr_of!({name}) as usize,
__test_static_{name}() as usize,
"{name} static");
}}
Expand Down Expand Up @@ -1804,7 +1806,8 @@ impl<'a> Generator<'a> {
fn __test_static_{name}() -> *{mutbl} {ty};
}}
unsafe {{
same(&{name} as *const _ as usize,
// We must use addr_of! here because of https://github.com/rust-lang/rust/issues/114447
same(std::ptr::addr_of!({name}) as usize,
__test_static_{name}() as usize,
"{name} static");
}}
Expand Down

0 comments on commit 4125710

Please sign in to comment.