poll-promise panics if the user drops the Sender before sending a value.
This is quite a footgun.
A dropped sender is a bug (because we cannot deliver a value), but I'm not sure it deserves a crash.
We could change the interface of Promise to return a Result, with an error for "DroppedSender".
We could also consider having the panic only in debug builds, and in release builds treat a dropped receiver the same as a receiver that hasn't sent anything yet, i.e. the promise will be stuck in "Pending" forever. Perhaps with a logged warning.
poll-promisepanics if the user drops theSenderbefore sending a value.This is quite a footgun.
A dropped sender is a bug (because we cannot deliver a value), but I'm not sure it deserves a crash.
We could change the interface of
Promiseto return a Result, with an error for "DroppedSender".We could also consider having the panic only in debug builds, and in release builds treat a dropped receiver the same as a receiver that hasn't sent anything yet, i.e. the promise will be stuck in "Pending" forever. Perhaps with a logged warning.