]> git.proxmox.com Git - rustc.git/blame - src/test/run-pass/placement-in-syntax.rs
New upstream version 1.19.0+dfsg1
[rustc.git] / src / test / run-pass / placement-in-syntax.rs
CommitLineData
c1a9b12d
SL
1// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2// file at the top-level directory of this distribution and at
3// http://rust-lang.org/COPYRIGHT.
4//
5// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8// option. This file may not be copied, modified, or distributed
9// except according to those terms.
10
11#![allow(dead_code, unused_variables)]
12#![feature(box_heap)]
13#![feature(placement_in_syntax)]
14
15// Tests that the new `in` syntax works with unique pointers.
16//
17// Compare with new-box-syntax.rs
18
19use std::boxed::{Box, HEAP};
20
21struct Structure {
22 x: isize,
23 y: isize,
24}
25
26pub fn main() {
27 let x: Box<isize> = in HEAP { 2 };
28 let b: Box<isize> = in HEAP { 1 + 2 };
29 let c = in HEAP { 3 + 4 };
30
31 let s: Box<Structure> = in HEAP {
32 Structure {
33 x: 3,
34 y: 4,
35 }
36 };
37}