From 3a54ab78efc66c17a6d2bb57463f5dac4696c7ed Mon Sep 17 00:00:00 2001 From: Oleg Nosov Date: Tue, 5 Nov 2019 15:22:03 +0300 Subject: [PATCH 1/3] LinkedList: PhantomData>> => PhantomData --- src/liballoc/collections/linked_list.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/liballoc/collections/linked_list.rs b/src/liballoc/collections/linked_list.rs index 702df250999fb..da06203a2cbec 100644 --- a/src/liballoc/collections/linked_list.rs +++ b/src/liballoc/collections/linked_list.rs @@ -39,7 +39,7 @@ pub struct LinkedList { head: Option>>, tail: Option>>, len: usize, - marker: PhantomData>>, + marker: PhantomData, } struct Node { @@ -60,7 +60,7 @@ pub struct Iter<'a, T: 'a> { head: Option>>, tail: Option>>, len: usize, - marker: PhantomData<&'a Node>, + marker: PhantomData<&'a T>, } #[stable(feature = "collection_debug", since = "1.17.0")] @@ -90,7 +90,7 @@ impl Clone for Iter<'_, T> { #[stable(feature = "rust1", since = "1.0.0")] pub struct IterMut<'a, T: 'a> { // We do *not* exclusively own the entire list here, references to node's `element` - // have been handed out by the iterator! So be careful when using this; the methods + // have been handed out by the iterator! So be careful when using this; the methods // called must be aware that there can be aliasing pointers to `element`. list: &'a mut LinkedList, head: Option>>, From 45f281d46166fb90c7e9403ad814bebb67aa926d Mon Sep 17 00:00:00 2001 From: Oleg Nosov Date: Tue, 5 Nov 2019 23:34:54 +0300 Subject: [PATCH 2/3] Reverted PhantomData in LinkedList, fixed PhantomData markers in Rc and Arc --- src/liballoc/collections/linked_list.rs | 4 ++-- src/liballoc/rc.rs | 2 +- src/liballoc/sync.rs | 2 +- src/libcore/cell.rs | 4 +++- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/liballoc/collections/linked_list.rs b/src/liballoc/collections/linked_list.rs index da06203a2cbec..8d73f352fd4a1 100644 --- a/src/liballoc/collections/linked_list.rs +++ b/src/liballoc/collections/linked_list.rs @@ -39,7 +39,7 @@ pub struct LinkedList { head: Option>>, tail: Option>>, len: usize, - marker: PhantomData, + marker: PhantomData>>, } struct Node { @@ -60,7 +60,7 @@ pub struct Iter<'a, T: 'a> { head: Option>>, tail: Option>>, len: usize, - marker: PhantomData<&'a T>, + marker: PhantomData<&'a Node>, } #[stable(feature = "collection_debug", since = "1.17.0")] diff --git a/src/liballoc/rc.rs b/src/liballoc/rc.rs index f1c4c32e116ea..a11f9e8c14579 100644 --- a/src/liballoc/rc.rs +++ b/src/liballoc/rc.rs @@ -280,7 +280,7 @@ struct RcBox { #[stable(feature = "rust1", since = "1.0.0")] pub struct Rc { ptr: NonNull>, - phantom: PhantomData, + phantom: PhantomData>, } #[stable(feature = "rust1", since = "1.0.0")] diff --git a/src/liballoc/sync.rs b/src/liballoc/sync.rs index 80d6c6e0d4390..4b10f089c2950 100644 --- a/src/liballoc/sync.rs +++ b/src/liballoc/sync.rs @@ -195,7 +195,7 @@ const MAX_REFCOUNT: usize = (isize::MAX) as usize; #[stable(feature = "rust1", since = "1.0.0")] pub struct Arc { ptr: NonNull>, - phantom: PhantomData, + phantom: PhantomData>, } #[stable(feature = "rust1", since = "1.0.0")] diff --git a/src/libcore/cell.rs b/src/libcore/cell.rs index fda103a52d8bc..c381998d99a89 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 { -//! ptr: NonNull> +//! ptr: NonNull>, +//! phantom: PhantomData>, //! } //! //! struct RcBox { From 6a5931921ca751b8c6748111d15c5d97cb47fab4 Mon Sep 17 00:00:00 2001 From: Oleg Nosov Date: Wed, 6 Nov 2019 01:03:31 +0300 Subject: [PATCH 3/3] Fixed libcore/cell.rs example --- src/libcore/cell.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/libcore/cell.rs b/src/libcore/cell.rs index c381998d99a89..817c04d0af924 100644 --- a/src/libcore/cell.rs +++ b/src/libcore/cell.rs @@ -153,7 +153,10 @@ //! impl Clone for Rc { //! fn clone(&self) -> Rc { //! self.inc_strong(); -//! Rc { ptr: self.ptr } +//! Rc { +//! ptr: self.ptr, +//! phantom: PhantomData, +//! } //! } //! } //!