Review feedback: add unstable marker to Placer API and put in bound that now works.

This commit is contained in:
Felix S. Klock II 2015-07-23 16:01:46 +02:00
parent 1905a49875
commit 73df224f05
2 changed files with 9 additions and 1 deletions

View file

@ -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)]

View file

@ -1285,6 +1285,7 @@ impl<T: ?Sized+Unsize<U>, 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<Data: ?Sized> {
/// 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<Data: ?Sized> {
/// 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<Data: ?Sized> {
/// `Place` is the intermedate agent guarding the
/// uninitialized state for `Data`.
@ -1325,6 +1327,7 @@ pub trait Placer<Data: ?Sized> {
}
/// Specialization of `Place` trait supporting `in (PLACE) EXPR`.
#[unstable(feature = "placement_new_protocol")]
pub trait InPlace<Data: ?Sized>: Place<Data> {
/// `Owner` is the type of the end value of `in (PLACE) EXPR`
///
@ -1361,11 +1364,12 @@ pub trait InPlace<Data: ?Sized>: Place<Data> {
/// `<T as Boxed>` in turn dictates determines which
/// implementation of `BoxPlace` to use, namely:
/// `<<T as Boxed>::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<Self::Data> */
type Place: BoxPlace<Self::Data>;
/// 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<Data: ?Sized> : Place<Data> {
/// Creates a globally fresh place.
fn make_place() -> Self;