Closed edef1c closed 7 years ago
More specifically, we can only make a generator Send
if everything on the generator stack is Send
. Since we have no practical way of enforcing that, we must be conservative and not make generators Send
.
Wait, we don't have a 'thread lifetime: https://github.com/rust-lang/rfcs/pull/1705#issuecomment-260061724.
@whitequark The actual lifetime of TLS memory is (at most) 'thread
, but that's indeed not expressible in the type system.
On hosted platforms, libstd allows safely borrowing values from TLS with 'thread lifetime and without a Sync bound. As a result, we can't guarantee that sending a generator across threads won't create dangling references or data races. In freestanding environments, the notion of thread-safety is likely to be defined by the consumer of libfringe, so our Send bounds and implementation are unlikely to be meaningful anyway.