diff options
| author | Huon Wilson <dbau.pp+github@gmail.com> | 2015-02-13 15:15:05 +1100 |
|---|---|---|
| committer | Huon Wilson <dbau.pp+github@gmail.com> | 2015-02-18 08:19:21 +1100 |
| commit | cae969e2a755bd7e8ec22758a8a02146ddb599a4 (patch) | |
| tree | e861a8a0c9cb6d40fa5bb3e3c40fa60bfa98b25a /src/libcore | |
| parent | f9aeea7cb7865a2b82e7102837daabbe549177ea (diff) | |
| download | rust-cae969e2a755bd7e8ec22758a8a02146ddb599a4.tar.gz rust-cae969e2a755bd7e8ec22758a8a02146ddb599a4.zip | |
Remove the implicit `'static` bound on `Send`.
Previously Send was defined as `trait Send: 'static {}`. As detailed in
https://github.com/rust-lang/rfcs/pull/458, the `'static` bound is not
actually necessary for safety, we can use lifetimes to enforce that more
flexibly.
`unsafe` code that was previously relying on `Send` to insert a
`'static` bound now may allow incorrect patterns, and so should be
audited (a quick way to ensure safety immediately and postpone the audit
is to add an explicit `'static` bound to any uses of the `Send` type).
cc #22251.
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/marker.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/libcore/marker.rs b/src/libcore/marker.rs index da93d4f6ca4..f5b42b3c858 100644 --- a/src/libcore/marker.rs +++ b/src/libcore/marker.rs @@ -32,9 +32,19 @@ use clone::Clone; reason = "will be overhauled with new lifetime rules; see RFC 458")] #[lang="send"] #[rustc_on_unimplemented = "`{Self}` cannot be sent between threads safely"] +#[cfg(stage0)] // SNAP ac134f7 remove after stage0 pub unsafe trait Send: 'static { // empty. } +/// Types able to be transferred across thread boundaries. +#[unstable(feature = "core", + reason = "will be overhauled with new lifetime rules; see RFC 458")] +#[lang="send"] +#[rustc_on_unimplemented = "`{Self}` cannot be sent between threads safely"] +#[cfg(not(stage0))] +pub unsafe trait Send { + // empty. +} /// Types with a constant size known at compile-time. #[stable(feature = "rust1", since = "1.0.0")] |
