Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't implement Send at all #67

Merged
merged 2 commits into from Mar 6, 2017
Merged

Don't implement Send at all #67

merged 2 commits into from Mar 6, 2017

Conversation

edef1c
Copy link
Owner

@edef1c edef1c commented Mar 5, 2017

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.

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.
@Amanieu
Copy link
Collaborator

Amanieu commented Mar 5, 2017

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.

Now that the Send bound is gone, we can simply use a Cell instead of a
raw pointer.
@whitequark
Copy link
Contributor

Wait, we don't have a 'thread lifetime: rust-lang/rfcs#1705 (comment).

@edef1c
Copy link
Owner Author

edef1c commented Mar 6, 2017

@whitequark The actual lifetime of TLS memory is (at most) 'thread, but that's indeed not expressible in the type system.

@edef1c edef1c merged commit 2b64d96 into master Mar 6, 2017
@edef1c edef1c deleted the no-send branch March 6, 2017 08:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants