summary refs log tree commit diff
path: root/src/liballoc/vec.rs
diff options
context:
space:
mode:
authorSimon Sapin <simon.sapin@exyr.org>2017-12-15 18:58:40 +0100
committerSimon Sapin <simon.sapin@exyr.org>2017-12-16 06:58:16 +0100
commit60dc10492ccdf785678d475172f2653aae9606da (patch)
treec144f62864685f7e94caf4bbde3fc034b2f6b327 /src/liballoc/vec.rs
parent5a0dc2d06d92d3bef7502d2095cd0d51486d4e12 (diff)
downloadrust-60dc10492ccdf785678d475172f2653aae9606da.tar.gz
rust-60dc10492ccdf785678d475172f2653aae9606da.zip
Move PhantomData<T> from Shared<T> to users of both Shared and #[may_dangle]
After discussing [1] today with @pnkfelix and @Gankro,
we concluded that it’s ok for drop checking not to be much smarter
than the current `#[may_dangle]` design which requires an explicit
unsafe opt-in.

[1] https://github.com/rust-lang/rust/issues/27730#issuecomment-316432083
Diffstat (limited to 'src/liballoc/vec.rs')
-rw-r--r--src/liballoc/vec.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/liballoc/vec.rs b/src/liballoc/vec.rs
index 9c7c8657716..67ccb5cab6d 100644
--- a/src/liballoc/vec.rs
+++ b/src/liballoc/vec.rs
@@ -71,6 +71,7 @@ use core::fmt;
 use core::hash::{self, Hash};
 use core::intrinsics::{arith_offset, assume};
 use core::iter::{FromIterator, FusedIterator, TrustedLen};
+use core::marker::PhantomData;
 use core::mem;
 #[cfg(not(test))]
 use core::num::Float;
@@ -1743,6 +1744,7 @@ impl<T> IntoIterator for Vec<T> {
             mem::forget(self);
             IntoIter {
                 buf: Shared::new_unchecked(begin),
+                phantom: PhantomData,
                 cap,
                 ptr: begin,
                 end,
@@ -2264,6 +2266,7 @@ impl<'a, T> FromIterator<T> for Cow<'a, [T]> where T: Clone {
 #[stable(feature = "rust1", since = "1.0.0")]
 pub struct IntoIter<T> {
     buf: Shared<T>,
+    phantom: PhantomData<T>,
     cap: usize,
     ptr: *const T,
     end: *const T,