From 73df224f0559e31e6d4623978cf25ada9ba1e2d8 Mon Sep 17 00:00:00 2001 From: "Felix S. Klock II" Date: Thu, 23 Jul 2015 16:01:46 +0200 Subject: [PATCH] Review feedback: add unstable marker to Placer API and put in bound that now works. --- src/liballoc/lib.rs | 3 +++ src/libcore/ops.rs | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/liballoc/lib.rs b/src/liballoc/lib.rs index 480c1a502c6f..f66495c4057c 100644 --- a/src/liballoc/lib.rs +++ b/src/liballoc/lib.rs @@ -70,6 +70,8 @@ test(no_crate_inject))] #![no_std] +// SNAP d4432b3 +#![allow(unused_features)] // until feature(placement_in_syntax) is in snap #![feature(allocator)] #![feature(box_syntax)] #![feature(coerce_unsized)] @@ -83,6 +85,7 @@ #![feature(nonzero)] #![feature(optin_builtin_traits)] #![feature(placement_in_syntax)] +#![feature(placement_new_protocol)] #![feature(raw)] #![feature(staged_api)] #![feature(unboxed_closures)] diff --git a/src/libcore/ops.rs b/src/libcore/ops.rs index 18e4e282f222..2ea42011a5cf 100644 --- a/src/libcore/ops.rs +++ b/src/libcore/ops.rs @@ -1285,6 +1285,7 @@ impl, U: ?Sized> CoerceUnsized<*const U> for *const T {} /// If evaluating EXPR fails, then the destructor for the /// implementation of Place to clean up any intermediate state /// (e.g. deallocate box storage, pop a stack, etc). +#[unstable(feature = "placement_new_protocol")] pub trait Place { /// Returns the address where the input value will be written. /// Note that the data at this address is generally uninitialized, @@ -1315,6 +1316,7 @@ pub trait Place { /// Values for types implementing this trait usually are transient /// intermediate values (e.g. the return value of `Vec::emplace_back`) /// or `Copy`, since the `make_place` method takes `self` by value. +#[unstable(feature = "placement_new_protocol")] pub trait Placer { /// `Place` is the intermedate agent guarding the /// uninitialized state for `Data`. @@ -1325,6 +1327,7 @@ pub trait Placer { } /// Specialization of `Place` trait supporting `in (PLACE) EXPR`. +#[unstable(feature = "placement_new_protocol")] pub trait InPlace: Place { /// `Owner` is the type of the end value of `in (PLACE) EXPR` /// @@ -1361,11 +1364,12 @@ pub trait InPlace: Place { /// `` in turn dictates determines which /// implementation of `BoxPlace` to use, namely: /// `<::Place as BoxPlace>`. +#[unstable(feature = "placement_new_protocol")] pub trait Boxed { /// The kind of data that is stored in this kind of box. type Data; /* (`Data` unused b/c cannot yet express below bound.) */ /// The place that will negotiate the storage of the data. - type Place; /* should be bounded by BoxPlace */ + type Place: BoxPlace; /// Converts filled place into final owning value, shifting /// deallocation/cleanup responsibilities (if any remain), over to @@ -1374,6 +1378,7 @@ pub trait Boxed { } /// Specialization of `Place` trait supporting `box EXPR`. +#[unstable(feature = "placement_new_protocol")] pub trait BoxPlace : Place { /// Creates a globally fresh place. fn make_place() -> Self;