Skip to content

Commit e3fbd3c

Browse files
authored
Rollup merge of rust-lang#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>>`).
2 parents 5723176 + 6a59319 commit e3fbd3c

File tree

4 files changed

+10
-5
lines changed

4 files changed

+10
-5
lines changed

src/liballoc/collections/linked_list.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ impl<T> Clone for Iter<'_, T> {
9090
#[stable(feature = "rust1", since = "1.0.0")]
9191
pub struct IterMut<'a, T: 'a> {
9292
// We do *not* exclusively own the entire list here, references to node's `element`
93-
// have been handed out by the iterator! So be careful when using this; the methods
93+
// have been handed out by the iterator! So be careful when using this; the methods
9494
// called must be aware that there can be aliasing pointers to `element`.
9595
list: &'a mut LinkedList<T>,
9696
head: Option<NonNull<Node<T>>>,

src/liballoc/rc.rs

+1-1
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

+1-1
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

+7-2
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> {
@@ -151,7 +153,10 @@
151153
//! impl<T: ?Sized> Clone for Rc<T> {
152154
//! fn clone(&self) -> Rc<T> {
153155
//! self.inc_strong();
154-
//! Rc { ptr: self.ptr }
156+
//! Rc {
157+
//! ptr: self.ptr,
158+
//! phantom: PhantomData,
159+
//! }
155160
//! }
156161
//! }
157162
//!

0 commit comments

Comments
 (0)