Skip to content

Commit 410f741

Browse files
committed
Remove references to Own.
1 parent 5b85baa commit 410f741

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

text/0000-send-improvements.md

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,6 @@ follows:
1414

1515
unsafe impl<'a, T> Send for &'a T where T: Sync + 'a {}
1616
```
17-
* Add an `Own` trait that is basically `Send + 'static` for convenience:
18-
19-
```rust
20-
trait Own : Send + 'static { }
21-
impl<T:Send+'static> Own for T { }
22-
```
2317
* Evaluate each `Send` bound currently in `libstd` and either leave it as-is, add an
2418
explicit `'static` bound, or bound it with another lifetime parameter.
2519

@@ -100,8 +94,6 @@ guaranteed to be threadsafe by Rust's type system.
10094

10195
Another important note is that with this definition, `Send` will fulfill the proposed role of `Sync` in a fork-join concurrency library. At present, to use `Sync` in a fork-join library one must make the implicit assumption that if `T` is `Sync`, `T` is `Send`. One might be tempted to codify this by making `Sync` a subtype of `Send`. Unfortunately, this is not always the case, though it should be most of the time. A type can be created with `&mut` methods that are not thread safe, but no `&`-methods that are not thread safe. An example would be a version of `Rc` called `RcMut`. `RcMut` would have a `clone_mut()` method that took `&mut self` and no other `clone()` method. `RcMut` could be thread-safely shared provided that a `&mut RcMut` was not sent to another thread. As long as that invariant was upheld, `RcMut` could only be cloned in its original thread and could not be dropped while shared (hence, `RcMut` is `Sync`) but a mutable reference could not be thread-safely shared, nor could it be moved into another thread (hence, `&mut RcMut` is not `Send`, which means that `RcMut` is not `Send`). Because `&T` is Send if `T` is Sync (per the new definition), adding a `Send` bound will guarantee that only shared pointers of this type are moved between threads, so our new definition of `Send` preserves thread safety in the presence of such types.
10296

103-
Thirdly, we'd add an `Own` trait as specified above. This would be used mostly as a convenience in user and library code for the current cases where `Send` is being used as a proxy for `Send + 'static`.
104-
10597
Finally, we'd hunt through existing instances of `Send` in Rust libraries and replace them with
10698
sensible defaults. For example, the `spawn()` APIs should all have `'static` bounds,
10799
preserving current behavior. I don't think this would be too difficult, but it may be that there
@@ -195,7 +187,7 @@ impl<T> Deref<T> for RcMut<T> {
195187

196188
# Drawbacks
197189

198-
Libraries get a bit more complicated to write, since you may have to write `Send + 'static` where previously you just wrote `Send`. Also, code that is currently using `Send` as a proxy for `'static` may need to be updated backwards incompatibly to use `Own`. With the `Own` type, I don't think this will be a huge issue going forward, though.
190+
Libraries get a bit more complicated to write, since you may have to write `Send + 'static` where previously you just wrote `Send`.
199191

200192
# Alternatives
201193

0 commit comments

Comments
 (0)