It's probably not the most beautiful solution, but it should cover all cases.
Maybe it would be nicer to not erase the type from TaskSource in TaskSource::new and wrap the source stored in JoinHandle into ManuallyDrop(TaskSourceStorage(Source)), but I'm not sure whether this is more elegant. The only advantage would be that you could not pass a non-TaskSourceSource to JoinHandle::new, which is currently possible and would cause unsafe behavior (due to freeing unknown memory).
Fixes #1326
It's probably not the most beautiful solution, but it should cover all cases.
Maybe it would be nicer to not erase the type from
TaskSource
inTaskSource::new
and wrap the source stored inJoinHandle
intoManuallyDrop(TaskSourceStorage(Source))
, but I'm not sure whether this is more elegant. The only advantage would be that you could not pass a non-TaskSource
Source
toJoinHandle::new
, which is currently possible and would cause unsafe behavior (due to freeing unknown memory).