Description
@eddyb points out that the handling of address space for function pointers (introduced by #73270) is fundamentally wrong: PointeeInfo
can be used for optimization hints only and also only becomes relevant way too late during compilation. To properly account for function pointers having a different address space, they need to be added in the Pointer
variant of the Primitive
ABI type. That is the only way to fix types like Result<&i32, fn()>
, which are currently going horribly wrong for Harvard architectures because the enum layout algorithm will think that &i32
and fn()
are exactly the same fundamental type, and put them into one and the same field (resulting LLVM layout: { i64, ptr }
).
Not sure whom to ping here, so I will pick some people that seem to be active in an around AVR: @dylanmckay @Patryk27.
Also Cc @rust-lang/compiler since this is related to some pretty fundamental compiler infrastructure