Skip to content

Commit e70472f

Browse files
committed
Auto merge of #56955 - cramertj:fundamental-arc, r=<try>
Make Rc and Arc #[fundamental] Fixes #24317. r? @alexcrichton and @rust-lang/libs
2 parents d99a320 + 69e465a commit e70472f

File tree

4 files changed

+9
-4
lines changed

4 files changed

+9
-4
lines changed

src/liballoc/rc.rs

+1
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,7 @@ struct RcBox<T: ?Sized> {
283283
/// [get_mut]: #method.get_mut
284284
#[cfg_attr(not(test), lang = "rc")]
285285
#[stable(feature = "rust1", since = "1.0.0")]
286+
#[fundamental]
286287
pub struct Rc<T: ?Sized> {
287288
ptr: NonNull<RcBox<T>>,
288289
phantom: PhantomData<T>,

src/liballoc/sync.rs

+1
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ const MAX_REFCOUNT: usize = (isize::MAX) as usize;
200200
/// [rc_examples]: ../../std/rc/index.html#examples
201201
#[cfg_attr(not(test), lang = "arc")]
202202
#[stable(feature = "rust1", since = "1.0.0")]
203+
#[fundamental]
203204
pub struct Arc<T: ?Sized> {
204205
ptr: NonNull<ArcInner<T>>,
205206
phantom: PhantomData<T>,

src/libserialize/serialize.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -921,4 +921,7 @@ impl<T: UseSpecializedDecodable> Decodable for T {
921921
impl<'a, T: ?Sized + Encodable> UseSpecializedEncodable for &'a T {}
922922
impl<T: ?Sized + Encodable> UseSpecializedEncodable for Box<T> {}
923923
impl<T: Decodable> UseSpecializedDecodable for Box<T> {}
924-
924+
impl<T: ?Sized + Encodable> UseSpecializedEncodable for Rc<T> {}
925+
impl<T: Decodable> UseSpecializedDecodable for Rc<T> {}
926+
impl<T: ?Sized + Encodable> UseSpecializedEncodable for Arc<T> {}
927+
impl<T: Decodable> UseSpecializedDecodable for Arc<T> {}

src/test/ui/issues/issue-41974.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
error[E0119]: conflicting implementations of trait `std::ops::Drop` for type `std::boxed::Box<_>`:
1+
error[E0119]: conflicting implementations of trait `std::ops::Drop` for type `std::sync::Arc<_>`:
22
--> $DIR/issue-41974.rs:17:1
33
|
44
LL | impl<T> Drop for T where T: A { //~ ERROR E0119
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66
|
77
= note: conflicting implementation in crate `alloc`:
8-
- impl<T> std::ops::Drop for std::boxed::Box<T>
8+
- impl<T> std::ops::Drop for std::sync::Arc<T>
99
where T: ?Sized;
10-
= note: downstream crates may implement trait `A` for type `std::boxed::Box<_>`
10+
= note: downstream crates may implement trait `A` for type `std::sync::Arc<_>`
1111

1212
error[E0120]: the Drop trait may only be implemented on structures
1313
--> $DIR/issue-41974.rs:17:18

0 commit comments

Comments
 (0)