Skip to content

Commit 73df224

Browse files
committed
Review feedback: add unstable marker to Placer API and put in bound that now works.
1 parent 1905a49 commit 73df224

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/liballoc/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@
7070
test(no_crate_inject))]
7171
#![no_std]
7272

73+
// SNAP d4432b3
74+
#![allow(unused_features)] // until feature(placement_in_syntax) is in snap
7375
#![feature(allocator)]
7476
#![feature(box_syntax)]
7577
#![feature(coerce_unsized)]
@@ -83,6 +85,7 @@
8385
#![feature(nonzero)]
8486
#![feature(optin_builtin_traits)]
8587
#![feature(placement_in_syntax)]
88+
#![feature(placement_new_protocol)]
8689
#![feature(raw)]
8790
#![feature(staged_api)]
8891
#![feature(unboxed_closures)]

src/libcore/ops.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1285,6 +1285,7 @@ impl<T: ?Sized+Unsize<U>, U: ?Sized> CoerceUnsized<*const U> for *const T {}
12851285
/// If evaluating EXPR fails, then the destructor for the
12861286
/// implementation of Place to clean up any intermediate state
12871287
/// (e.g. deallocate box storage, pop a stack, etc).
1288+
#[unstable(feature = "placement_new_protocol")]
12881289
pub trait Place<Data: ?Sized> {
12891290
/// Returns the address where the input value will be written.
12901291
/// Note that the data at this address is generally uninitialized,
@@ -1315,6 +1316,7 @@ pub trait Place<Data: ?Sized> {
13151316
/// Values for types implementing this trait usually are transient
13161317
/// intermediate values (e.g. the return value of `Vec::emplace_back`)
13171318
/// or `Copy`, since the `make_place` method takes `self` by value.
1319+
#[unstable(feature = "placement_new_protocol")]
13181320
pub trait Placer<Data: ?Sized> {
13191321
/// `Place` is the intermedate agent guarding the
13201322
/// uninitialized state for `Data`.
@@ -1325,6 +1327,7 @@ pub trait Placer<Data: ?Sized> {
13251327
}
13261328

13271329
/// Specialization of `Place` trait supporting `in (PLACE) EXPR`.
1330+
#[unstable(feature = "placement_new_protocol")]
13281331
pub trait InPlace<Data: ?Sized>: Place<Data> {
13291332
/// `Owner` is the type of the end value of `in (PLACE) EXPR`
13301333
///
@@ -1361,11 +1364,12 @@ pub trait InPlace<Data: ?Sized>: Place<Data> {
13611364
/// `<T as Boxed>` in turn dictates determines which
13621365
/// implementation of `BoxPlace` to use, namely:
13631366
/// `<<T as Boxed>::Place as BoxPlace>`.
1367+
#[unstable(feature = "placement_new_protocol")]
13641368
pub trait Boxed {
13651369
/// The kind of data that is stored in this kind of box.
13661370
type Data; /* (`Data` unused b/c cannot yet express below bound.) */
13671371
/// The place that will negotiate the storage of the data.
1368-
type Place; /* should be bounded by BoxPlace<Self::Data> */
1372+
type Place: BoxPlace<Self::Data>;
13691373

13701374
/// Converts filled place into final owning value, shifting
13711375
/// deallocation/cleanup responsibilities (if any remain), over to
@@ -1374,6 +1378,7 @@ pub trait Boxed {
13741378
}
13751379

13761380
/// Specialization of `Place` trait supporting `box EXPR`.
1381+
#[unstable(feature = "placement_new_protocol")]
13771382
pub trait BoxPlace<Data: ?Sized> : Place<Data> {
13781383
/// Creates a globally fresh place.
13791384
fn make_place() -> Self;

0 commit comments

Comments
 (0)