about summary refs log tree commit diff
path: root/src/libcore
diff options
context:
space:
mode:
authorYuki Okushi <huyuumi.dev@gmail.com>2019-11-07 09:20:44 +0900
committerGitHub <noreply@github.com>2019-11-07 09:20:44 +0900
commita2b4ad439cd11c3b9bfcc9b92c6feff6f7b0e042 (patch)
treedd846ce5449eedb50ea5b196defec5a597a81a26 /src/libcore
parent3032233bb277202a5336c2dedee999a1b3e698c3 (diff)
parent6a5931921ca751b8c6748111d15c5d97cb47fab4 (diff)
Rollup merge of #66117 - olegnn:fixed_linked_list_marker, r=RalfJung
Fixed PhantomData markers in Arc and Rc

Include owned internal structs in `PhantomData` markers in `Arc` (`PhantomData<T>` => `PhantomData<ArcInner<T>>`) and `Rc` (`PhantomData<T>` => `PhantomData<RcBox<T>>`).
Diffstat (limited to 'src/libcore')
-rw-r--r--src/libcore/cell.rs9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/libcore/cell.rs b/src/libcore/cell.rs
index fda103a52d8..817c04d0af9 100644
--- a/src/libcore/cell.rs
+++ b/src/libcore/cell.rs
@@ -137,9 +137,11 @@
 //! use std::cell::Cell;
 //! use std::ptr::NonNull;
 //! use std::intrinsics::abort;
+//! use std::marker::PhantomData;
 //!
 //! struct Rc<T: ?Sized> {
-//!     ptr: NonNull<RcBox<T>>
+//!     ptr: NonNull<RcBox<T>>,
+//!     phantom: PhantomData<RcBox<T>>,
 //! }
 //!
 //! struct RcBox<T: ?Sized> {
@@ -151,7 +153,10 @@
 //! impl<T: ?Sized> Clone for Rc<T> {
 //!     fn clone(&self) -> Rc<T> {
 //!         self.inc_strong();
-//!         Rc { ptr: self.ptr }
+//!         Rc {
+//!             ptr: self.ptr,
+//!             phantom: PhantomData,
+//!         }
 //!     }
 //! }
 //!