Open
Description
$ cat a.rs
pub static F: fn() = f::<u32>;
pub fn f<T>() {}
$ cat b.rs
static F: fn() = a::F;
fn main() {
assert_eq!(a::F, crate::F);
}
$ rustc --edition=2018 -O --crate-type=lib a.rs
$ rustc --edition=2018 -O --crate-type=bin b.rs -L. --extern a
$ ./b
thread 'main' panicked at 'assertion failed: `(left == right)`
left: `0x561f15182780`,
right: `0x561f15182660`'
The general issue is similar to #79738. In this case a function pointer is represented with GlobalAlloc::Function(Instance<'tcx>)
, which does not uniquely identify function after codegen.
cc @oli-obk
@rustbot modify labels: +A-codegen +A-const-eval