Skip to content

Commit bfa3e72

Browse files
Askar Safintgross35
Askar Safin
authored andcommitted
Replace references of static externs to addr_of!. We need to do this because of rust-lang/rust#114447
1 parent 4b98395 commit bfa3e72

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

ctest/src/lib.rs

+6-3
Original file line numberDiff line numberDiff line change
@@ -1716,7 +1716,8 @@ impl<'a> Generator<'a> {
17161716
fn __test_static_{name}() -> {ty};
17171717
}}
17181718
unsafe {{
1719-
same(*(&{name} as *const _ as *const {ty}) as usize,
1719+
// We must use addr_of! here because of https://github.com/rust-lang/rust/issues/114447
1720+
same(*(std::ptr::addr_of!({name}) as *const {ty}) as usize,
17201721
__test_static_{name}() as usize,
17211722
"{name} static");
17221723
}}
@@ -1760,7 +1761,8 @@ impl<'a> Generator<'a> {
17601761
fn __test_static_{name}() -> *{mutbl} {ty};
17611762
}}
17621763
unsafe {{
1763-
same(&{name} as *const _ as usize,
1764+
// We must use addr_of! here because of https://github.com/rust-lang/rust/issues/114447
1765+
same(std::ptr::addr_of!({name}) as usize,
17641766
__test_static_{name}() as usize,
17651767
"{name} static");
17661768
}}
@@ -1804,7 +1806,8 @@ impl<'a> Generator<'a> {
18041806
fn __test_static_{name}() -> *{mutbl} {ty};
18051807
}}
18061808
unsafe {{
1807-
same(&{name} as *const _ as usize,
1809+
// We must use addr_of! here because of https://github.com/rust-lang/rust/issues/114447
1810+
same(std::ptr::addr_of!({name}) as usize,
18081811
__test_static_{name}() as usize,
18091812
"{name} static");
18101813
}}

0 commit comments

Comments
 (0)