diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2015-03-24 15:27:14 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2015-03-24 15:27:14 -0700 |
| commit | 3b13b9c2b4e72d08cb1c68024ccc4f50001f4878 (patch) | |
| tree | d4efd6426beeeee1f0c543cfe345b9625285f46e /src/liballoc | |
| parent | 91b633aa038008fdbee658a10182afdd794d2aa6 (diff) | |
| parent | 1955e052675d4457432da85a00db0ae55be64e83 (diff) | |
| download | rust-3b13b9c2b4e72d08cb1c68024ccc4f50001f4878.tar.gz rust-3b13b9c2b4e72d08cb1c68024ccc4f50001f4878.zip | |
rollup merge of #23638: pnkfelix/fsk-reject-specialized-drops
Reject specialized Drop impls.
See Issue #8142 for discussion.
This makes it illegal for a Drop impl to be more specialized than the original item.
So for example, all of the following are now rejected (when they would have been blindly accepted before):
```rust
struct S<A> { ... };
impl Drop for S<i8> { ... } // error: specialized to concrete type
struct T<'a> { ... };
impl Drop for T<'static> { ... } // error: specialized to concrete region
struct U<A> { ... };
impl<A:Clone> Drop for U<A> { ... } // error: added extra type requirement
struct V<'a,'b>;
impl<'a,'b:a> Drop for V<'a,'b> { ... } // error: added extra region requirement
```
Due to examples like the above, this is a [breaking-change].
(The fix is to either remove the specialization from the `Drop` impl, or to transcribe the requirements into the struct/enum definition; examples of both are shown in the PR's fixed to `libstd`.)
----
This is likely to be the last thing blocking the removal of the `#[unsafe_destructor]` attribute.
Fix #8142
Fix #23584
Diffstat (limited to 'src/liballoc')
| -rw-r--r-- | src/liballoc/arc.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/liballoc/arc.rs b/src/liballoc/arc.rs index c9bbc0d74cd..b5d16d29272 100644 --- a/src/liballoc/arc.rs +++ b/src/liballoc/arc.rs @@ -321,7 +321,7 @@ impl<T: Send + Sync + Clone> Arc<T> { #[unsafe_destructor] #[stable(feature = "rust1", since = "1.0.0")] -impl<T: Sync + Send> Drop for Arc<T> { +impl<T> Drop for Arc<T> { /// Drops the `Arc<T>`. /// /// This will decrement the strong reference count. If the strong reference @@ -388,7 +388,7 @@ impl<T: Sync + Send> Drop for Arc<T> { #[unstable(feature = "alloc", reason = "Weak pointers may not belong in this module.")] -impl<T: Sync + Send> Weak<T> { +impl<T> Weak<T> { /// Upgrades a weak reference to a strong reference. /// /// Upgrades the `Weak<T>` reference to an `Arc<T>`, if possible. @@ -454,7 +454,7 @@ impl<T: Sync + Send> Clone for Weak<T> { #[unsafe_destructor] #[stable(feature = "rust1", since = "1.0.0")] -impl<T: Sync + Send> Drop for Weak<T> { +impl<T> Drop for Weak<T> { /// Drops the `Weak<T>`. /// /// This will decrement the weak reference count. |
