Skip to content

Make Rc and Arc #[fundamental] #56955

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/liballoc/rc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ struct RcBox<T: ?Sized> {
/// [get_mut]: #method.get_mut
#[cfg_attr(not(test), lang = "rc")]
#[stable(feature = "rust1", since = "1.0.0")]
#[fundamental]
pub struct Rc<T: ?Sized> {
ptr: NonNull<RcBox<T>>,
phantom: PhantomData<T>,
Expand Down
1 change: 1 addition & 0 deletions src/liballoc/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ const MAX_REFCOUNT: usize = (isize::MAX) as usize;
/// [rc_examples]: ../../std/rc/index.html#examples
#[cfg_attr(not(test), lang = "arc")]
#[stable(feature = "rust1", since = "1.0.0")]
#[fundamental]
pub struct Arc<T: ?Sized> {
ptr: NonNull<ArcInner<T>>,
phantom: PhantomData<T>,
Expand Down
5 changes: 4 additions & 1 deletion src/libserialize/serialize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -921,4 +921,7 @@ impl<T: UseSpecializedDecodable> Decodable for T {
impl<'a, T: ?Sized + Encodable> UseSpecializedEncodable for &'a T {}
impl<T: ?Sized + Encodable> UseSpecializedEncodable for Box<T> {}
impl<T: Decodable> UseSpecializedDecodable for Box<T> {}

impl<T: ?Sized + Encodable> UseSpecializedEncodable for Rc<T> {}
impl<T: Decodable> UseSpecializedDecodable for Rc<T> {}
impl<T: ?Sized + Encodable> UseSpecializedEncodable for Arc<T> {}
impl<T: Decodable> UseSpecializedDecodable for Arc<T> {}
6 changes: 3 additions & 3 deletions src/test/ui/issues/issue-41974.stderr
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
error[E0119]: conflicting implementations of trait `std::ops::Drop` for type `std::boxed::Box<_>`:
error[E0119]: conflicting implementations of trait `std::ops::Drop` for type `std::sync::Arc<_>`:
--> $DIR/issue-41974.rs:17:1
|
LL | impl<T> Drop for T where T: A { //~ ERROR E0119
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: conflicting implementation in crate `alloc`:
- impl<T> std::ops::Drop for std::boxed::Box<T>
- impl<T> std::ops::Drop for std::sync::Arc<T>
where T: ?Sized;
= note: downstream crates may implement trait `A` for type `std::boxed::Box<_>`
= note: downstream crates may implement trait `A` for type `std::sync::Arc<_>`

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