Remove 'static
bound requirement on DMA buffers?
#1245
Labels
documentation
Improvements or additions to documentation
peripheral:dma
DMA Peripheral
RFC
Request for comment
Milestone
To be 100% safe, buffers used with the embedded-dma traits must be static. This is because
core::mem::forget
is safe in Rust, and if a user were to forget a driver whilst a DMA transaction was occurring, the buffer could go out of scope and UB would occur. Not good.The issue is, is that
'static
bounds are a pain to work with, and I think in practice it's unlikely for users toforget
our drivers. I think it might be a good idea to have a trade-off here, to remove the'static
bounds to make the drivers easier to use. We can document each driver, and even have a section in our top level docs mentioning our drivers are not leak (forget) safe and must be dropped properly or manually stopped beforeforget
ing.The text was updated successfully, but these errors were encountered: