<thejpster[m]>
> We recommend using a union to set the reserved spots to 0; None (Option<fn()>) may also work but it’s not guaranteed that the None variant will always be represented by the value 0.
<chrysn[m]>
IIUC, NPO just says that pointers have a niche. 0 is an obvious niche, but any other invalid pointer would also work. (There are probably no alignment niche patterns on Cortex-M given that thumb mode is allowed and set by the LSB, but maybe 0xffffffff is just as invalid and thus for grabs as a niche).
<thejpster[m]>
transmute([0u8; _]) is definitely None for fn
<chrysn[m]>
… but indeed the guarantee you found goes further.
<thejpster[m]>
Cool. It makes the vector table much simpler. Something for version 0.8 perhaps.
<chrysn[m]>
It also helps with expressing the (IMO asinine) decision of many ARM implementers to start mapping flash at 0 and placing the initial vectors there.
Socke has quit [Ping timeout: 252 seconds]
Socke has joined #rust-embedded
sroemer has quit [Ping timeout: 246 seconds]
sroemer has joined #rust-embedded
<JamesMunns[m]>
I think it USED to not be guaranteed
<JamesMunns[m]>
NPO wasn't guaranteed until... some point? Likely after 2018 when that comment was probably written