Skip to content

Commit 23a4050

Browse files
committed
Weak's type parameter may dangle on drop
1 parent c441675 commit 23a4050

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

library/alloc/src/rc.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2303,7 +2303,7 @@ impl<T: ?Sized> Weak<T> {
23032303
}
23042304

23052305
#[stable(feature = "rc_weak", since = "1.4.0")]
2306-
impl<T: ?Sized> Drop for Weak<T> {
2306+
unsafe impl<#[may_dangle] T: ?Sized> Drop for Weak<T> {
23072307
/// Drops the `Weak` pointer.
23082308
///
23092309
/// # Examples

library/alloc/src/sync.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2015,7 +2015,7 @@ impl<T> Default for Weak<T> {
20152015
}
20162016

20172017
#[stable(feature = "arc_weak", since = "1.4.0")]
2018-
impl<T: ?Sized> Drop for Weak<T> {
2018+
unsafe impl<#[may_dangle] T: ?Sized> Drop for Weak<T> {
20192019
/// Drops the `Weak` pointer.
20202020
///
20212021
/// # Examples

0 commit comments

Comments
 (0)