Skip to content

Commit 45f281d

Browse files
committed
Reverted PhantomData in LinkedList, fixed PhantomData markers in Rc and Arc
1 parent 3a54ab7 commit 45f281d

File tree

4 files changed

+7
-5
lines changed

4 files changed

+7
-5
lines changed

src/liballoc/collections/linked_list.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ pub struct LinkedList<T> {
3939
head: Option<NonNull<Node<T>>>,
4040
tail: Option<NonNull<Node<T>>>,
4141
len: usize,
42-
marker: PhantomData<T>,
42+
marker: PhantomData<Box<Node<T>>>,
4343
}
4444

4545
struct Node<T> {
@@ -60,7 +60,7 @@ pub struct Iter<'a, T: 'a> {
6060
head: Option<NonNull<Node<T>>>,
6161
tail: Option<NonNull<Node<T>>>,
6262
len: usize,
63-
marker: PhantomData<&'a T>,
63+
marker: PhantomData<&'a Node<T>>,
6464
}
6565

6666
#[stable(feature = "collection_debug", since = "1.17.0")]

src/liballoc/rc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ struct RcBox<T: ?Sized> {
280280
#[stable(feature = "rust1", since = "1.0.0")]
281281
pub struct Rc<T: ?Sized> {
282282
ptr: NonNull<RcBox<T>>,
283-
phantom: PhantomData<T>,
283+
phantom: PhantomData<RcBox<T>>,
284284
}
285285

286286
#[stable(feature = "rust1", since = "1.0.0")]

src/liballoc/sync.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ const MAX_REFCOUNT: usize = (isize::MAX) as usize;
195195
#[stable(feature = "rust1", since = "1.0.0")]
196196
pub struct Arc<T: ?Sized> {
197197
ptr: NonNull<ArcInner<T>>,
198-
phantom: PhantomData<T>,
198+
phantom: PhantomData<ArcInner<T>>,
199199
}
200200

201201
#[stable(feature = "rust1", since = "1.0.0")]

src/libcore/cell.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,11 @@
137137
//! use std::cell::Cell;
138138
//! use std::ptr::NonNull;
139139
//! use std::intrinsics::abort;
140+
//! use std::marker::PhantomData;
140141
//!
141142
//! struct Rc<T: ?Sized> {
142-
//! ptr: NonNull<RcBox<T>>
143+
//! ptr: NonNull<RcBox<T>>,
144+
//! phantom: PhantomData<RcBox<T>>,
143145
//! }
144146
//!
145147
//! struct RcBox<T: ?Sized> {

0 commit comments

Comments
 (0)