RIOT-OS / rust-riot-wrappers

The `riot-wrappers` crate, which enables high-level access to RIOT from the Rust programming language
13 stars 10 forks source link

Needless lifetimes shenanigans #81

Closed chrysn closed 2 months ago

chrysn commented 9 months ago

See https://github.com/rust-embedded-community/embedded-nal/issues/103#issuecomment-1930076973 and responses.

chrysn commented 2 months ago

The claim of the comment was that relying on drop to unset the callback would be unsound because drop might not be called.

In that thread, I claimed that that's not an issue because the socket is only 'static anyway (and thus created this issue assuming that the lifetime could be removed from the ReceiveIntoArgs).

Looking at it again, the trouble is not with the socket, but with the buffer that is being received into.

The more accurate description would be that the callback goes to the socket to wake the task (for which it is indeed relevant that the struct is static), but then the buffer is only written to during the polling, which only happens if the task is still active.

Thus,

Therefore, I think the issue should just be closed.