Skip to content

Commit 056e581

Browse files
committed
Update tests for desugaring box and placement-in.
Namely: * Update run-pass/new-box-syntax * Fix doc-embedded test for `alloc::boxed` to reflect new syntax. * Fix test/debuginfo/box.rs to reflect new syntax. Part of what lands with Issue 22181.
1 parent 4a7df22 commit 056e581

File tree

3 files changed

+14
-9
lines changed

3 files changed

+14
-9
lines changed

src/liballoc/boxed.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,18 +63,19 @@ use core::ops::{Placer, Boxed, Place, InPlace, BoxPlace};
6363
use core::ptr::Unique;
6464
use core::raw::TraitObject;
6565

66-
/// A value that represents the heap. This is the default place that the `box`
67-
/// keyword allocates into when no place is supplied.
66+
/// A value that represents the heap. This is the place that the `box`
67+
/// keyword allocates into.
6868
///
6969
/// The following two examples are equivalent:
7070
///
7171
/// ```rust
7272
/// #![feature(box_syntax)]
73+
/// #![feature(placement_in_syntax)]
7374
/// use std::boxed::HEAP;
7475
///
7576
/// fn main() {
76-
/// let foo = box(HEAP) 5;
77-
/// let foo = box 5;
77+
/// let foo = in HEAP { 5 };
78+
/// let foo: Box<_> = box 5;
7879
/// }
7980
/// ```
8081
#[lang = "exchange_heap"]

src/test/debuginfo/box.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,14 @@
3232

3333
#![allow(unused_variables)]
3434
#![feature(box_syntax)]
35+
#![feature(placement_in_syntax)]
3536
#![omit_gdb_pretty_printer_section]
3637

38+
use std::boxed::HEAP;
39+
3740
fn main() {
38-
let a = box 1;
39-
let b = box() (2, 3.5f64);
41+
let a: Box<_> = box 1;
42+
let b = in HEAP { (2, 3.5f64) };
4043

4144
zzz(); // #break
4245
}

src/test/run-pass/new-box-syntax.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
#![allow(unknown_features)]
1515
#![feature(box_syntax)]
16+
#![feature(placement_in_syntax)]
1617

1718
// Tests that the new `box` syntax works with unique pointers.
1819

@@ -24,8 +25,8 @@ struct Structure {
2425
}
2526

2627
pub fn main() {
27-
let x: Box<int> = box(HEAP) 2;
28+
let x: Box<int> = in HEAP { 2 };
2829
let y: Box<int> = box 2;
29-
let b: Box<int> = box()(1 + 2);
30-
let c = box()(3 + 4);
30+
let b: Box<int> = box () (1 + 2);
31+
let c: Box<_> = box () (3 + 4);
3132
}

0 commit comments

Comments
 (0)