According to analysis performed by @bjorn3, this code actually leads to two allocations containing 42
, i.e., FOO
and BAR
point to different things. The linker later merges the two, so the issue is currently not directly observable. However, it becomes observable when things are mutable.
I think this is a bug. When a static is defined as pub static BAR: &i32 = crate::a::FOO;
, IMO we should guarantee that BAR
and FOO
have the same value. I see no lee-way here for duplicating the memory they both point to.
Cc @oli-obk
EkremDincel, jtmoon79, khoover, tylerarnold, tarcieri and 1 moretarcieri
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4